Skip to content

Commit 82ef310

Browse files
committed
WIP 332 Separate Site generation and publication ...
1 parent 7d3d407 commit 82ef310

File tree

4 files changed

+146
-162
lines changed

4 files changed

+146
-162
lines changed

.github/workflows/generate-site.yml

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
name: Generate Site
2+
3+
on:
4+
pull_request:
5+
push:
6+
workflow_dispatch:
7+
8+
jobs:
9+
build-artifacts:
10+
uses: ./.github/workflows/build-artifacts.yml
11+
with:
12+
# SonarQube requires JDK 17 or higher
13+
java-version: '17'
14+
15+
generate-site:
16+
needs: build-artifacts
17+
runs-on: ubuntu-latest
18+
concurrency:
19+
group: "${{ github.workflow }}-${{ github.ref }}-${{ inputs.publish_gh_pages }}"
20+
env:
21+
DTC_HEADLESS: true
22+
steps:
23+
- name: Install dot (Graphviz)
24+
run: |
25+
sudo apt-get update
26+
sudo apt-get install -y graphviz
27+
28+
- name: Cache Gradle packages
29+
uses: actions/cache@v4
30+
with:
31+
path: ~/.gradle/caches
32+
key: "${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}"
33+
restore-keys: ${{ runner.os }}-gradle
34+
35+
- name: Cache .doctoolchain
36+
uses: actions/cache@v4
37+
with:
38+
path: ~/.doctoolchain
39+
key: "${{ runner.os }}-doctoolchain-${{ hashFiles('**/lockfiles') }}"
40+
restore-keys: ${{ runner.os }}-doctoolchain
41+
42+
- name: Check out
43+
uses: actions/checkout@v4
44+
45+
- name: Setup JDK
46+
uses: actions/setup-java@v4
47+
with:
48+
distribution: temurin
49+
java-version: 17
50+
51+
- name: Download Artifacts
52+
uses: actions/download-artifact@v4
53+
with:
54+
name: build-artifacts
55+
path: .
56+
57+
- name: Validate Gradle Wrapper
58+
uses: gradle/actions/wrapper-validation@v4
59+
60+
- name: Generate Site
61+
run: ./generate-pages
62+
63+
- name: 'Publish Test Results'
64+
uses: EnricoMi/publish-unit-test-result-action/linux@v2
65+
if: always()
66+
with:
67+
files: |
68+
**/build/test-results/**/*.xml
69+
70+
- name: Upload Generated Site
71+
uses: actions/upload-pages-artifact@v3
72+
with:
73+
name: github-pages
74+
path: public
75+
retention-days: 7

.github/workflows/gh-pages.yml

Lines changed: 0 additions & 162 deletions
This file was deleted.
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: Publish GitHub Pages
2+
3+
on:
4+
workflow_dispatch:
5+
6+
jobs:
7+
publish-to-github:
8+
runs-on: ubuntu-latest
9+
permissions:
10+
contents: read
11+
pages: write
12+
id-token: write
13+
environment:
14+
name: github-pages
15+
url: ${{ steps.deployment.outputs.page_url }}
16+
steps:
17+
- name: Configure Pages
18+
uses: actions/configure-pages@v5
19+
20+
- name: Deploy Pages
21+
id: deployment
22+
uses: actions/deploy-pages@v4
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
name: Publish to Netlify
2+
3+
on:
4+
workflow_dispatch:
5+
6+
jobs:
7+
publish-to-netlify:
8+
runs-on: ubuntu-latest
9+
environment:
10+
name: netlify
11+
url: ${{ steps.netlify-status.outputs.NETLIFY_DEPLOY_URL }}
12+
steps:
13+
- name: Download Generated Site Artifact
14+
uses: actions/download-artifact@v4
15+
with:
16+
name: github-pages
17+
path: download
18+
19+
- name: Unpack Generated Site
20+
run: |
21+
mkdir -p public
22+
tar -x -C public -v -f download/artifact.tar
23+
24+
- name: Cache Netlify CLI
25+
uses: actions/cache@v4
26+
with:
27+
path: ~/.npm
28+
key: ${{ runner.os }}-netlify-cli-${{ hashFiles('**/package-lock.json') }}
29+
restore-keys: ${{ runner.os }}-netlify-cli
30+
31+
- name: Deploy to Netlify
32+
uses: South-Paw/action-netlify-cli@v2
33+
id: netlify
34+
with:
35+
args: deploy --dir ./public --message 'draft [${{ github.sha }}]' --json
36+
env:
37+
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
38+
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
39+
40+
- name: Get Netlify Preview URL
41+
id: netlify-status
42+
run: |
43+
echo "NETLIFY_DEPLOY_URL=${{ fromJson(steps.netlify.outputs.NETLIFY_OUTPUT).deploy_url }}" >> $GITHUB_OUTPUT
44+
45+
echo "The URL where the logs from the deployment can be found"
46+
echo "${{ fromJson(steps.netlify.outputs.NETLIFY_OUTPUT).logs }}"
47+
echo ""
48+
echo "the URL of the draft site that Netlify provides"
49+
echo "${{ fromJson(steps.netlify.outputs.NETLIFY_OUTPUT).deploy_url }}/"

0 commit comments

Comments
 (0)