|
6 | 6 | push:
|
7 | 7 | branches: ["main"]
|
8 | 8 |
|
9 |
| - # Allows you to run this workflow manually from the Actions tab |
10 |
| - workflow_dispatch: |
11 |
| - |
12 | 9 | # Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
|
13 | 10 | permissions:
|
14 | 11 | contents: read
|
15 | 12 | pages: write
|
16 | 13 | id-token: write
|
17 | 14 |
|
18 |
| -# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued. |
19 |
| -# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete. |
20 |
| -concurrency: |
21 |
| - group: "pages" |
22 |
| - cancel-in-progress: false |
23 |
| - |
24 |
| -# Default to bash |
25 |
| -defaults: |
26 |
| - run: |
27 |
| - shell: bash |
| 15 | +# Environment variables available to all jobs and steps in this workflow |
| 16 | +env: |
| 17 | + HUGO_ENV: production |
| 18 | + HUGO_VERSION: "0.139.2" |
| 19 | + GO_VERSION: "1.23.3" |
| 20 | + NODE_VERSION: "20.0.0" |
| 21 | + TINA_CLIENT_ID: ${{ vars.TINA_CLIENT_ID }} |
| 22 | + TINA_TOKEN: ${{ vars.TINA_TOKEN }} |
28 | 23 |
|
29 | 24 | jobs:
|
30 | 25 | # Build job
|
31 | 26 | build:
|
32 | 27 | runs-on: ubuntu-latest
|
33 |
| - env: |
34 |
| - HUGO_VERSION: 0.139.2 |
35 | 28 | steps:
|
36 |
| - - name: Install Hugo CLI |
37 |
| - run: | |
38 |
| - wget -O ${{ runner.temp }}/hugo.deb https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_extended_${HUGO_VERSION}_linux-amd64.deb \ |
39 |
| - && sudo dpkg -i ${{ runner.temp }}/hugo.deb |
40 |
| - - name: Install Node.js and PostCSS |
41 |
| - uses: actions/setup-node@v3 |
| 29 | + - uses: actions/checkout@v4 |
| 30 | + - name: Set up Node.js |
| 31 | + uses: actions/setup-node@v4 |
42 | 32 | with:
|
43 |
| - node-version: 16 |
44 |
| - - name: Install Dependencies |
| 33 | + node-version: ${{ env.NODE_VERSION }} |
| 34 | + |
| 35 | + - name: Install Hugo |
45 | 36 | run: |
|
46 |
| - npm install |
47 |
| - - name: Checkout Repository |
48 |
| - uses: actions/checkout@v4 |
49 |
| - with: |
50 |
| - submodules: recursive |
51 |
| - - name: Build with Hugo |
52 |
| - env: |
53 |
| - HUGO_CACHEDIR: ${{ runner.temp }}/hugo_cache |
54 |
| - HUGO_ENVIRONMENT: production |
| 37 | + curl -LO "https://github.com/gohugoio/hugo/releases/download/v${{ env.HUGO_VERSION }}/hugo_extended_${{ env.HUGO_VERSION }}_Linux-64bit.tar.gz" |
| 38 | + tar -xvf hugo_extended_${{ env.HUGO_VERSION }}_Linux-64bit.tar.gz |
| 39 | + sudo mv hugo /usr/local/bin/ |
| 40 | + rm hugo_extended_${{ env.HUGO_VERSION }}_Linux-64bit.tar.gz |
| 41 | + hugo version |
| 42 | +
|
| 43 | + - name: Install Go |
55 | 44 | run: |
|
56 |
| - hugo \ |
57 |
| - --minify \ |
58 |
| - --baseURL "${{ steps.pages.outputs.base_url }}/" |
59 |
| - - name: Upload Artifact |
| 45 | + curl -LO "https://dl.google.com/go/go${{ env.GO_VERSION }}.linux-amd64.tar.gz" |
| 46 | + sudo tar -C /usr/local -xzf go${{ env.GO_VERSION }}.linux-amd64.tar.gz |
| 47 | + echo "export PATH=$PATH:/usr/local/go/bin" >> $GITHUB_ENV |
| 48 | + rm go${{ env.GO_VERSION }}.linux-amd64.tar.gz |
| 49 | + go version |
| 50 | +
|
| 51 | + - name: Setup Project |
| 52 | + run: npm run project-setup |
| 53 | + |
| 54 | + - name: Install npm dependencies |
| 55 | + run: npm install |
| 56 | + |
| 57 | + - name: Publish to GitHub Pages |
| 58 | + run: npm run build |
| 59 | + |
| 60 | + - name: Upload artifact |
60 | 61 | uses: actions/upload-pages-artifact@v3
|
61 | 62 | with:
|
62 | 63 | path: ./public
|
|
0 commit comments