Skip to content

Commit 563e92b

Browse files
authored
ci: restructure build pipeline for dual deployment (#32)
* ci: restructure build pipeline for dual deployment Replace withastro/action with explicit steps so the workflow produces both a GitHub Pages artifact and a generic dist/ artifact. Adds pull_request trigger for future preview support. GitHub Pages deploy is conditioned on push to main so PRs don't trigger deployment. Closes chinmina-docs-7yn.1 * ci: fix corepack enable and update action versions Replace non-existent enable-corepack input on setup-node with an explicit corepack enable run step. Update actions to latest versions: setup-node v6, upload-pages-artifact v4, upload-artifact v7, deploy-pages v5. * ci: update checkout to v6 * ci: replace .mise.toml with .tool-versions for node version Switch from mise.toml to the asdf-compatible .tool-versions file so both mise and actions/setup-node (via node-version-file) read the node version from a single authoritative source.
1 parent 6a85cdd commit 563e92b

3 files changed

Lines changed: 24 additions & 13 deletions

File tree

.github/workflows/deploy.yaml

Lines changed: 23 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
11
name: Deploy to GitHub Pages
22

33
on:
4-
# Trigger the workflow every time you push to the `main` branch
5-
# Using a different branch name? Replace `main` with your branch’s name
64
push:
75
branches: [main]
8-
# Allows you to run this workflow manually from the Actions tab on GitHub.
6+
pull_request:
97
workflow_dispatch:
108

119
# Allow this job to clone the repo and create a page deployment
@@ -19,24 +17,38 @@ jobs:
1917
runs-on: ubuntu-latest
2018
steps:
2119
- name: Checkout your repository using git
22-
uses: actions/checkout@v4
20+
uses: actions/checkout@v6
2321
- name: Install D2 diagramming tool
2422
run: |
2523
curl -fsSL https://d2lang.com/install.sh | sh -s --
26-
- name: Install, build, and upload your site
27-
uses: withastro/action@v4
28-
# with:
29-
# path: . # The root location of your Astro project inside the repository. (optional)
30-
# node-version: 20 # The specific version of Node that should be used to build your site. Defaults to 20. (optional)
31-
# package-manager: pnpm@latest # The Node package manager that should be used to install dependencies and build your site. Automatically detected based on your lockfile. (optional)
24+
- name: Set up Node.js
25+
uses: actions/setup-node@v6
26+
with:
27+
node-version-file: .tool-versions
28+
- name: Enable corepack
29+
run: corepack enable
30+
- name: Install dependencies
31+
run: pnpm install
32+
- name: Build site
33+
run: pnpm run build
34+
- name: Upload GitHub Pages artifact
35+
uses: actions/upload-pages-artifact@v4
36+
with:
37+
path: dist/
38+
- name: Upload dist artifact
39+
uses: actions/upload-artifact@v7
40+
with:
41+
name: dist
42+
path: dist/
3243

3344
deploy:
3445
needs: build
46+
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
3547
runs-on: ubuntu-latest
3648
environment:
3749
name: github-pages
3850
url: ${{ steps.deployment.outputs.page_url }}
3951
steps:
4052
- name: Deploy to GitHub Pages
4153
id: deployment
42-
uses: actions/deploy-pages@v4
54+
uses: actions/deploy-pages@v5

.mise.toml

Lines changed: 0 additions & 2 deletions
This file was deleted.

.tool-versions

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
nodejs 24

0 commit comments

Comments
 (0)