File tree Expand file tree Collapse file tree 3 files changed +64
-17
lines changed
Expand file tree Collapse file tree 3 files changed +64
-17
lines changed Original file line number Diff line number Diff line change 1+ name : Cleanup staging
2+ description : Cleanup staging environment; this occurs on PR merge or close
3+
4+ on :
5+ pull_request :
6+ types : [closed]
7+
8+ jobs :
9+ cleanup-staging :
10+ uses : omsf/static-site-tools/.github/workflows/cleanup-cloudflare.yaml@main
11+ with :
12+ pr_number : ${{ github.event.pull_request.number }}
13+ project_name : ${{ vars.CLOUDFLARE_PROJECT_NAME }}
14+ secrets :
15+ CLOUDFLARE_API_TOKEN : ${{ secrets.CLOUDFLARE_API_TOKEN }}
16+ CLOUDFLARE_ACCOUNT_ID : ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
Original file line number Diff line number Diff line change @@ -10,31 +10,28 @@ jobs:
1010 env :
1111 HUGO_VERSION : 0.141.0
1212 steps :
13- - name : Install Hugo CLI
14- run : |
15- wget -O ${{ runner.temp }}/hugo.deb https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_extended_${HUGO_VERSION}_linux-amd64.deb \
16- && sudo dpkg -i ${{ runner.temp }}/hugo.deb
17- - name : Install Dart Sass
18- run : sudo snap install dart-sass
1913 - name : Checkout
2014 uses : actions/checkout@v4
2115 with :
2216 submodules : recursive
2317 fetch-depth : 0
2418 - name : Install Node.js dependencies
2519 run : " [[ -f package-lock.json || -f npm-shrinkwrap.json ]] && npm ci || true"
26- - name : Build with Hugo
27- env :
28- HUGO_CACHEDIR : ${{ runner.temp }}/hugo_cache
29- HUGO_ENVIRONMENT : production
30- TZ : America/Los_Angeles
31- run : |
32- hugo \
33- --gc \
34- --minify
20+
21+ - name : Build site
22+ uses : omsf/static-site-tools/build/hugo@main
23+ with :
24+ base-url : " "
25+
26+ - name : Make artifact
27+ shell : bash
28+ run : tar czf site.tar.gz docs
29+
3530 - name : Upload build artifact
31+ if : ${{ github.event_name != 'schedule' }}
3632 uses : actions/upload-artifact@v4
3733 with :
3834 name : pr-preview-${{ github.event.pull_request.number }}
39- path : ./docs
40- retention-days : 7
35+ path : site.tar.gz
36+ if-no-files-found : error
37+ retention-days : 1
Original file line number Diff line number Diff line change 1+ name : Upload to staging
2+ on :
3+ workflow_run :
4+ workflows : ["PR Build Test"]
5+ types :
6+ - completed
7+ jobs :
8+ get-metadata :
9+ runs-on : ubuntu-latest
10+ outputs :
11+ pr_number : ${{ steps.pr-metadata.outputs.pr-number }}
12+ pr_headsha : ${{ steps.pr-metadata.outputs.pr-headsha }}
13+ steps :
14+ - name : Get PR metadata from action
15+ id : pr-metadata
16+ uses : omsf/static-site-tools/pr-info-from-workflow-run@main
17+ with :
18+ github-token : ${{ secrets.GITHUB_TOKEN }}
19+ stage :
20+ if : ${{ github.event.workflow_run.conclusion == 'success' }}
21+ needs : get-metadata
22+ uses : omsf/static-site-tools/.github/workflows/stage-cloudflare.yaml@main
23+ permissions :
24+ statuses : write
25+ pull-requests : write
26+ with :
27+ run-id : ${{ github.event.workflow_run.id }}
28+ pr-number : ${{ fromJSON(needs.get-metadata.outputs.pr_number) }} # convert to int
29+ pr-headsha : ${{ needs.get-metadata.outputs.pr_headsha }}
30+ project-name : ${{ vars.CLOUDFLARE_PROJECT_NAME }}
31+ html-dir : _site
32+ secrets :
33+ CLOUDFLARE_API_TOKEN : ${{ secrets.CLOUDFLARE_API_TOKEN }}
34+ CLOUDFLARE_ACCOUNT_ID : ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
You can’t perform that action at this time.
0 commit comments