Move docsite build scripts to Taskfile, make the electron tasks depend on them (#1298)

This adds the new tasks `docsite:start`, `docsite:build:public`,
`docsite:build:embedded`, `storybook:build`, and `copyfiles:*:*` to
Taskfile.

It also updates the "Build Helper" and "Docsite and Storybook CI/CD"
workflows to use these new tasks.

It also makes the docsite embedded build a dependency of the electron
tasks, ensuring that the embedded docsite is included when building
locally.

Tested and confirms this works on Windows
This commit is contained in:
Evan Simkowitz 2024-11-15 12:19:31 -08:00 committed by GitHub
parent 546a59aa54
commit 3b117805fe
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 73 additions and 17 deletions

View File

@ -25,15 +25,18 @@ jobs:
run: | run: |
corepack enable corepack enable
yarn install yarn install
working-directory: docs/ - name: Install Task
uses: arduino/setup-task@v2
with:
version: 3.x
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Build embedded docsite - name: Build embedded docsite
run: yarn build-embedded run: task docsite:build:embedded
working-directory: docs/
- name: Upload Build Artifact - name: Upload Build Artifact
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v4
with: with:
name: docsite name: docsite
path: docs/build path: docsite
build-app: build-app:
needs: build-docsite needs: build-docsite
outputs: outputs:

View File

@ -32,18 +32,17 @@ jobs:
- uses: actions/setup-node@v4 - uses: actions/setup-node@v4
with: with:
node-version: ${{env.NODE_VERSION}} node-version: ${{env.NODE_VERSION}}
- name: Install Task
uses: arduino/setup-task@v2
with:
version: 3.x
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Install yarn - name: Install yarn
run: | run: |
corepack enable corepack enable
yarn install yarn install
- name: Build docsite - name: Build docsite
run: yarn build run: task docsite:build:public
working-directory: docs/
- name: Build Storybook
run: yarn build-storybook
- name: Copy Storybook to docsite output
run: cp -r storybook-static docs/build/storybook
- name: Upload Build Artifact - name: Upload Build Artifact
# Only upload the build artifact when pushed to the main branch # Only upload the build artifact when pushed to the main branch
if: github.event_name == 'push' && github.ref == 'refs/heads/main' if: github.event_name == 'push' && github.ref == 'refs/heads/main'

View File

@ -21,6 +21,7 @@ tasks:
cmd: yarn dev cmd: yarn dev
deps: deps:
- yarn - yarn
- docsite:build:embedded
- build:backend - build:backend
env: env:
WCLOUD_ENDPOINT: "https://ot2e112zx5.execute-api.us-west-2.amazonaws.com/dev" WCLOUD_ENDPOINT: "https://ot2e112zx5.execute-api.us-west-2.amazonaws.com/dev"
@ -31,6 +32,7 @@ tasks:
cmd: yarn start cmd: yarn start
deps: deps:
- yarn - yarn
- docsite:build:embedded
- build:backend - build:backend
env: env:
WCLOUD_ENDPOINT: "https://ot2e112zx5.execute-api.us-west-2.amazonaws.com/dev" WCLOUD_ENDPOINT: "https://ot2e112zx5.execute-api.us-west-2.amazonaws.com/dev"
@ -39,6 +41,54 @@ tasks:
storybook: storybook:
desc: Start the Storybook server. desc: Start the Storybook server.
cmd: yarn storybook cmd: yarn storybook
deps:
- yarn
storybook:build:
desc: Build the Storybook static site.
cmd: yarn build-storybook
generates:
- storybook-static/**/*
deps:
- yarn
docsite:start:
desc: Start the docsite dev server.
cmd: yarn start
dir: docs
deps:
- yarn
docsite:build:public:
desc: Build the full docsite.
cmds:
- cd docs && yarn build
- task: copyfiles:'storybook-static/':'docs/build/storybook'
sources:
- "docs/*"
- "docs/src/**/*"
- "docs/docs/**/*"
- "docs/static/**/*"
generates:
- "docs/build/**/*"
deps:
- yarn
- storybook:build
docsite:build:embedded:
desc: Build the embedded docsite and copy it to ./docsite
sources:
- "docs/*"
- "docs/src/**/*"
- "docs/docs/**/*"
- "docs/static/**/*"
generates:
- "docsite/**/*"
cmds:
- cd docs && yarn build-embedded
- task: copyfiles:'docs/build/':'../docsite'
deps:
- yarn
package: package:
desc: Package the application for the current platform. desc: Package the application for the current platform.
@ -66,8 +116,7 @@ tasks:
build:server:macos: build:server:macos:
desc: Build the wavesrv component for macOS (Darwin) platforms (generates artifacts for both arm64 and amd64). desc: Build the wavesrv component for macOS (Darwin) platforms (generates artifacts for both arm64 and amd64).
status: platforms: [darwin]
- exit {{if eq OS "darwin"}}1{{else}}0{{end}}
cmds: cmds:
- cmd: "{{.RM}} dist/bin/wavesrv*" - cmd: "{{.RM}} dist/bin/wavesrv*"
ignore_error: true ignore_error: true
@ -77,8 +126,7 @@ tasks:
build:server:windows: build:server:windows:
desc: Build the wavesrv component for Windows platforms (only generates artifacts for the current architecture). desc: Build the wavesrv component for Windows platforms (only generates artifacts for the current architecture).
status: platforms: [windows]
- exit {{if eq OS "windows"}}1{{else}}0{{end}}
cmds: cmds:
- cmd: "{{.RM}} dist/bin/wavesrv*" - cmd: "{{.RM}} dist/bin/wavesrv*"
ignore_error: true ignore_error: true
@ -89,8 +137,7 @@ tasks:
build:server:linux: build:server:linux:
desc: Build the wavesrv component for Linux platforms (only generates artifacts for the current architecture). desc: Build the wavesrv component for Linux platforms (only generates artifacts for the current architecture).
status: platforms: [linux]
- exit {{if eq OS "linux"}}1{{else}}0{{end}}
cmds: cmds:
- cmd: "{{.RM}} dist/bin/wavesrv*" - cmd: "{{.RM}} dist/bin/wavesrv*"
ignore_error: true ignore_error: true
@ -273,3 +320,10 @@ tasks:
sources: sources:
- go.mod - go.mod
cmd: go mod tidy cmd: go mod tidy
copyfiles:*:*:
desc: Recursively copy directory contents to a new directory, creating the directory if needed.
internal: true
cmds:
- '{{if eq OS "windows"}}powershell New-Item -Path "." -Force -Name "{{index .MATCH 1}}" -ItemType "directory"{{else}}mkdir -p {{index .MATCH 1}}{{end}}'
- '{{if eq OS "windows"}}powershell Copy-Item -Recurse -Force -Path {{index .MATCH 0}} -Destination {{index .MATCH 1}}{{else}}cp -r {{index .MATCH 0}} {{index .MATCH 1}}{{end}}'