Skip to content

Commit cc65643

Browse files
committed
ci: Use GHA workflow for publishing pages site
1 parent 99a386e commit cc65643

File tree

6 files changed

+86
-68
lines changed

6 files changed

+86
-68
lines changed

.github/workflows/checks.yml

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,13 @@ on:
1919
permissions:
2020
contents: read
2121

22+
defaults:
23+
run:
24+
shell: bash
25+
2226
jobs:
2327
unit-test:
2428
runs-on: ubuntu-22.04
25-
defaults:
26-
run:
27-
shell: bash
2829
steps:
2930
- name: Check out code
3031
uses: actions/checkout@v4
@@ -55,9 +56,6 @@ jobs:
5556

5657
e2e-test:
5758
runs-on: ubuntu-22.04
58-
defaults:
59-
run:
60-
shell: bash
6159
steps:
6260
- name: Check out code
6361
uses: actions/checkout@v4
@@ -103,9 +101,6 @@ jobs:
103101

104102
lint-go:
105103
runs-on: ubuntu-22.04
106-
defaults:
107-
run:
108-
shell: bash
109104
steps:
110105
- name: Check out code
111106
uses: actions/checkout@v4
@@ -153,9 +148,6 @@ jobs:
153148

154149
pre-commit:
155150
runs-on: ubuntu-22.04
156-
defaults:
157-
run:
158-
shell: bash
159151
steps:
160152
- name: Check out code
161153
uses: actions/checkout@v4
@@ -190,9 +182,6 @@ jobs:
190182

191183
lint-test-helm:
192184
runs-on: ubuntu-22.04
193-
defaults:
194-
run:
195-
shell: bash
196185
steps:
197186
- name: Checkout
198187
uses: actions/checkout@v4

.github/workflows/codeql-analysis.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,14 @@ on:
77
schedule:
88
- cron: '32 21 * * 2'
99

10+
defaults:
11+
run:
12+
shell: bash
13+
1014
jobs:
1115
analyze:
1216
name: Analyze
1317
runs-on: ubuntu-22.04
14-
defaults:
15-
run:
16-
shell: bash
1718
permissions:
1819
actions: read
1920
contents: read

.github/workflows/dependabot-automation.yaml

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,14 @@ permissions:
1212
pull-requests: write
1313
contents: write
1414

15+
defaults:
16+
run:
17+
shell: bash
18+
1519
jobs:
1620
auto-approve:
1721
if: ${{ github.event.pull_request.user.login == 'dependabot[bot]' }}
1822
runs-on: ubuntu-22.04
19-
defaults:
20-
run:
21-
shell: bash
2223
steps:
2324
- name: Dependabot metadata
2425
id: dependabot-metadata
@@ -39,9 +40,6 @@ jobs:
3940
enable-automerge:
4041
if: ${{ github.event.pull_request.user.login == 'dependabot[bot]'}}
4142
runs-on: ubuntu-22.04
42-
defaults:
43-
run:
44-
shell: bash
4543
steps:
4644
- name: Dependabot metadata
4745
id: dependabot-metadata

.github/workflows/devbox-update.yaml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,14 @@ permissions:
1212
contents: write
1313
pull-requests: write
1414

15+
defaults:
16+
run:
17+
shell: bash
18+
1519
jobs:
1620
devbox-update:
1721
if: github.ref_type == 'branch'
1822
runs-on: ubuntu-22.04
19-
defaults:
20-
run:
21-
shell: bash
2223
env:
2324
DESTINATION_BRANCH: scheduled-devbox-update-${{ github.ref_name }}
2425
steps:

.github/workflows/github-pages.yml

Lines changed: 66 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,54 +1,82 @@
11
# Copyright 2023 D2iQ, Inc. All rights reserved.
22
# SPDX-License-Identifier: Apache-2.0
33

4-
name: GitHub Pages
4+
# Sample workflow for building and deploying a Hugo site to GitHub Pages
5+
name: Deploy Hugo site to Pages
56

67
on:
8+
# Runs on pushes targeting the default branch
79
push:
810
branches:
911
- main
1012
pull_request:
13+
# Allows you to run this workflow manually from the Actions tab
14+
workflow_dispatch:
15+
16+
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
17+
permissions:
18+
contents: read
19+
pages: write
20+
id-token: write
21+
22+
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
23+
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
24+
concurrency:
25+
group: "pages"
26+
cancel-in-progress: false
27+
28+
# Default to bash
29+
defaults:
30+
run:
31+
shell: bash
32+
working-directory: ./docs
1133

1234
jobs:
13-
deploy:
35+
# Build job
36+
build:
1437
runs-on: ubuntu-22.04
15-
defaults:
16-
run:
17-
shell: bash
18-
permissions:
19-
contents: write
20-
concurrency:
21-
group: ${{ github.workflow }}-${{ github.ref }}
22-
cancel-in-progress: true
38+
env:
39+
HUGO_VERSION: 0.120.4
2340
steps:
24-
- uses: actions/checkout@v4
25-
with:
26-
fetch-depth: 0
27-
28-
- name: Setup Hugo
29-
uses: peaceiris/actions-hugo@v2
30-
with:
31-
hugo-version: '0.117.0'
32-
extended: true
33-
34-
- name: Setup Node
35-
uses: actions/setup-node@v4
41+
- name: Install Hugo CLI
42+
run: |
43+
wget -O "${{ runner.temp }}/hugo.deb https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_extended_${HUGO_VERSION}_linux-amd64.deb" \
44+
&& sudo dpkg -i ${{ runner.temp }}/hugo.deb
45+
- name: Install Dart Sass
46+
run: sudo snap install dart-sass
47+
- name: Checkout
48+
uses: actions/checkout@v4
3649
with:
37-
node-version: '18'
38-
cache: 'npm'
39-
cache-dependency-path: '**/package-lock.json'
40-
41-
- name: Install necessary packages
42-
run: npm ci
43-
working-directory: ./docs/
44-
45-
- name: Build
46-
run: hugo --minify
47-
working-directory: ./docs/
48-
49-
- name: Deploy
50-
uses: peaceiris/actions-gh-pages@v3
50+
submodules: recursive
51+
- name: Setup Pages
52+
id: pages
53+
uses: actions/configure-pages@v4
54+
- name: Install Node.js dependencies
55+
run: if [[ -f package-lock.json || -f npm-shrinkwrap.json ]]; then npm ci; fi
56+
- name: Build with Hugo
57+
env:
58+
# For maximum backward compatibility with Hugo modules
59+
HUGO_ENVIRONMENT: production
60+
HUGO_ENV: production
61+
run: |
62+
hugo \
63+
--minify \
64+
--baseURL "${{ steps.pages.outputs.base_url }}/"
65+
- name: Upload artifact
5166
if: github.ref == 'refs/heads/main'
67+
uses: actions/upload-pages-artifact@v3
5268
with:
53-
github_token: ${{ secrets.GITHUB_TOKEN }}
54-
publish_dir: ./docs/public
69+
path: ./docs/public
70+
71+
# Deployment job
72+
deploy:
73+
environment:
74+
name: github-pages
75+
url: ${{ steps.deployment.outputs.page_url }}
76+
runs-on: ubuntu-22.04
77+
needs: build
78+
if: github.ref == 'refs/heads/main'
79+
steps:
80+
- name: Deploy to GitHub Pages
81+
id: deployment
82+
uses: actions/deploy-pages@v4

.github/workflows/release-tag.yaml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,13 @@ permissions:
1313
contents: write
1414
packages: write
1515

16+
defaults:
17+
run:
18+
shell: bash
19+
1620
jobs:
1721
release-tag:
1822
runs-on: ubuntu-22.04
19-
defaults:
20-
run:
21-
shell: bash
2223
steps:
2324
- uses: actions/checkout@v4
2425
with:

0 commit comments

Comments
 (0)