Skip to content

Commit 8b0d3db

Browse files
authored
refactor ci (#24)
1 parent f92098c commit 8b0d3db

File tree

1 file changed

+26
-31
lines changed

1 file changed

+26
-31
lines changed

.github/workflows/publish.yaml

Lines changed: 26 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -8,41 +8,36 @@ on:
88
- .github
99
- README.md
1010
- LICENSE
11+
workflow_dispatch:
1112

1213
jobs:
1314
deploy:
1415
runs-on: ubuntu-latest
15-
if: "! contains(toJSON(github.event.commits.*.message), '[skip ci]')"
1616
steps:
17-
- name: Check out current branch
17+
- name: checkout
1818
uses: actions/checkout@v4
19-
- name: Prepare Alpine Linux with tools (latest)
20-
uses: jirutka/setup-alpine@v1
2119
with:
22-
extra-repositories: |
23-
https://dl-cdn.alpinelinux.org/alpine/edge/community
24-
packages: >
25-
bash
26-
hugo
27-
nodejs
28-
npm
29-
opencc
30-
git
31-
- name: Execute OpenCC in Alpine
32-
run: bash ./scripts/opencc.sh
33-
shell: alpine.sh {0}
34-
- name: Prepare Node.js packages in Alpine
35-
run: npm ci
36-
shell: alpine.sh {0}
37-
- name: Build the site in Alpine
38-
run: hugo --minify
39-
env:
40-
HUGO_DISABLELANGUAGES: 'en'
41-
shell: alpine.sh {0}
42-
- name: Upload to CloudFlare
43-
run: npx wrangler pages deploy public --project-name tfsci --branch main
44-
if: github.ref == 'refs/heads/main'
45-
env:
46-
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CF_ACCOUNT_ID }}
47-
CLOUDFLARE_API_TOKEN: ${{ secrets.CF_API_TOKEN }}
48-
shell: bash
20+
fetch-depth: 0
21+
submodules: true
22+
23+
- uses: DeterminateSystems/nix-installer-action@main
24+
25+
- name: Install Node.js
26+
uses: actions/setup-node@v4
27+
with:
28+
node-version: '22'
29+
cache: 'npm'
30+
31+
- name: Install npm dependencies
32+
run: npm install
33+
34+
- name: Build site
35+
run: nix run github:nixos/nixpkgs/nixos-24.11#hugo -- --minify --enableGitInfo
36+
37+
- name: Deploy to Cloudflare Pages
38+
id: deploy
39+
uses: cloudflare/wrangler-action@v3
40+
with:
41+
apiToken: ${{ secrets.CF_API_TOKEN }}
42+
accountId: ${{ secrets.CF_ACCOUNT_ID }}
43+
command: pages deploy public --project-name=tfsci

0 commit comments

Comments
 (0)