-
Notifications
You must be signed in to change notification settings - Fork 245
ci: deploy production docs on release, main preview on push #2389
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
50b0d50
docs(rfc): deploy docs on release with a main preview site
fengmk2 dcfff45
ci: deploy production docs on release, main preview on push
fengmk2 b2b9856
ci: extract docs deploy steps into a shared composite action
fengmk2 513eca9
ci: announce the release only after the docs deploy
fengmk2 2affd34
docs(rfc): apply vp fmt to deploy-docs-on-release
fengmk2 57c6854
docs: document single-pending-slot concurrency semantics for docs dep…
fengmk2 5e1e04e
docs(site): point install URLs at the deploy origin on preview builds
fengmk2 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,87 @@ | ||
| name: 'Build and deploy docs' | ||
| description: >- | ||
| Build the VitePress docs site (which bundles install.sh / install.ps1 into | ||
| its public assets) and deploy it to a void.app project. Run on a Linux | ||
| runner after checkout. See rfcs/deploy-docs-on-release.md for which | ||
| workflow deploys to which project. | ||
|
|
||
| inputs: | ||
| void-project: | ||
| description: 'void.app project to deploy to (e.g. viteplus, viteplus-main).' | ||
| required: true | ||
| void-token: | ||
| description: 'void.app deploy token (pass secrets.VOID_TOKEN).' | ||
| required: true | ||
| cache-ref: | ||
| description: >- | ||
| Ref-scoped segment of the Vite Task cache key: main, or pr-<number> for | ||
| PR previews. Non-main refs fall back to the main cache on restore. | ||
| required: false | ||
| default: 'main' | ||
| cache-sha: | ||
| description: 'Commit sha that scopes the primary cache key.' | ||
| required: false | ||
| default: ${{ github.sha }} | ||
| site-origin: | ||
| description: >- | ||
| Origin of this deploy when it is not production viteplus.dev | ||
| (e.g. https://main.viteplus.dev). When set, the docs build rewrites the | ||
| https://vite.plus installer URLs to this origin's install scripts. | ||
| Leave empty for production. | ||
| required: false | ||
| default: '' | ||
|
|
||
| runs: | ||
| using: 'composite' | ||
| steps: | ||
| - uses: voidzero-dev/setup-vp@250f29ce396baf5e8f24498e17c0dfdebabc26eb # main | ||
| with: | ||
| cache: true | ||
| working-directory: docs | ||
| cache-dependency-path: docs/pnpm-lock.yaml | ||
|
|
||
| - name: Compute Vite Task cache keys | ||
| id: cache-keys | ||
| shell: bash | ||
| env: | ||
| CACHE_REF: ${{ inputs.cache-ref }} | ||
| CACHE_SHA: ${{ inputs.cache-sha }} | ||
| run: | | ||
| prefix="vite-task-docs-${RUNNER_OS}-${RUNNER_ARCH}" | ||
| { | ||
| echo "key=${prefix}-${CACHE_REF}-${CACHE_SHA}" | ||
| echo 'restore-keys<<EOF' | ||
| echo "${prefix}-${CACHE_REF}-" | ||
| if [ "$CACHE_REF" != 'main' ]; then | ||
| echo "${prefix}-main-" | ||
| fi | ||
| echo 'EOF' | ||
| } >> "$GITHUB_OUTPUT" | ||
|
|
||
| - name: Restore docs Vite Task cache | ||
| id: vite-task-cache | ||
| uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0 | ||
| with: | ||
| path: docs/node_modules/.vite/task-cache | ||
| key: ${{ steps.cache-keys.outputs.key }} | ||
| # Prefer this ref's newest cache; Vite Task fingerprints decide reuse. | ||
| restore-keys: ${{ steps.cache-keys.outputs.restore-keys }} | ||
|
|
||
| - run: vp run build | ||
| shell: bash | ||
| working-directory: docs | ||
| env: | ||
| DOCS_SITE_ORIGIN: ${{ inputs.site-origin }} | ||
|
|
||
| - name: Save docs Vite Task cache | ||
| if: success() && steps.vite-task-cache.outputs.cache-hit != 'true' | ||
| uses: actions/cache/save@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0 | ||
| with: | ||
| path: docs/node_modules/.vite/task-cache | ||
| key: ${{ steps.vite-task-cache.outputs.cache-primary-key }} | ||
|
|
||
| - run: vpx void deploy --dir docs/.vitepress/dist | ||
| shell: bash | ||
| env: | ||
| VOID_PROJECT: ${{ inputs.void-project }} | ||
| VOID_TOKEN: ${{ inputs.void-token }} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| name: Deploy Docs Main Preview | ||
|
|
||
| permissions: {} | ||
|
|
||
| # Deploys the docs at the head of main to main.viteplus.dev (the viteplus-main | ||
| # void.app project) so developers can preview unreleased docs. Production | ||
| # viteplus.dev deploys from release.yml instead. | ||
| # See rfcs/deploy-docs-on-release.md. | ||
| on: | ||
| push: | ||
| branches: [main] | ||
| paths: | ||
| - 'docs/**' | ||
| - 'packages/cli/install.sh' | ||
| - 'packages/cli/install.ps1' | ||
| - '.github/workflows/deploy-docs-main.yml' | ||
| - '.github/actions/deploy-docs/**' | ||
|
|
||
| concurrency: | ||
| group: deploy-docs-main | ||
| cancel-in-progress: true | ||
|
|
||
| defaults: | ||
| run: | ||
| shell: bash | ||
|
|
||
| jobs: | ||
| deploy: | ||
| if: github.repository == 'voidzero-dev/vite-plus' | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: read | ||
| steps: | ||
| - uses: taiki-e/checkout-action@7d1e50e93dc4fb3bba58f85018fadf77898aee8b # v1.4.2 | ||
|
|
||
| - uses: ./.github/actions/deploy-docs | ||
| with: | ||
| void-project: viteplus-main | ||
| void-token: ${{ secrets.VOID_TOKEN }} | ||
| site-origin: https://main.viteplus.dev |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.