Skip to content

Commit fc19f44

Browse files
committed
Use GitHub Actions instead of Netlify (#2462)
Signed-off-by: Daniel Gray <dngray@privacyguides.org>
1 parent 0b43cb1 commit fc19f44

27 files changed

+512
-1424
lines changed
Lines changed: 30 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright (c) 2021-2023 Jonah Aragon <jonah@triplebit.net>
1+
# Copyright (c) 2024 Jonah Aragon <jonah@triplebit.net>
22

33
# Permission is hereby granted, free of charge, to any person obtaining a copy
44
# of this software and associated documentation files (the "Software"), to
@@ -18,59 +18,50 @@
1818
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
1919
# IN THE SOFTWARE.
2020

21-
name: 📦 Releases
21+
name: Build Offline Website
2222

2323
on:
24-
push:
25-
tags:
26-
- '*'
24+
workflow_call:
25+
26+
permissions:
27+
contents: read
2728

2829
jobs:
29-
production:
30-
name: Push release to production
30+
build:
3131
runs-on: ubuntu-latest
32-
environment:
33-
name: actions-ssh
3432
permissions:
35-
contents: write
33+
contents: read
3634

3735
steps:
3836
- name: Checkout repository
3937
uses: actions/checkout@v4
4038
with:
41-
fetch-depth: '0'
42-
ssh-key: ${{ secrets.ACTIONS_SSH_KEY }}
43-
submodules: 'true'
44-
45-
- name: Push to production branch
46-
run: |
47-
git push origin HEAD:production
39+
persist-credentials: 'false'
4840

49-
build:
50-
name: Create release packages
51-
runs-on: ubuntu-latest
52-
environment:
53-
name: actions-ssh
54-
55-
steps:
56-
- name: Checkout repository
57-
uses: actions/checkout@v4
41+
- uses: actions/download-artifact@v4
5842
with:
59-
fetch-depth: '0'
60-
ssh-key: ${{ secrets.ACTIONS_SSH_KEY }}
61-
submodules: 'true'
43+
pattern: repo-*
44+
path: modules
45+
46+
- run: |
47+
rmdir modules/mkdocs-material
48+
mv modules/repo-mkdocs-material-insiders modules/mkdocs-material
49+
rmdir theme/assets/brand
50+
mv modules/repo-brand theme/assets/brand
6251
6352
- name: Python setup
6453
uses: actions/setup-python@v5
6554
with:
6655
python-version: '3.8'
6756
cache: 'pipenv'
6857

69-
- name: Cache files
70-
uses: actions/cache@v4.0.2
58+
- uses: actions/cache/restore@v4.0.2
7159
with:
72-
key: ${{ github.ref }}
60+
key: site-cache-${{ github.repository }}-en-${{ github.ref }}-${{ hashfiles('.cache/**') }}
7361
path: .cache
62+
restore-keys: |
63+
site-cache-${{ github.repository }}-en-${{ github.ref }}-
64+
site-cache-${{ github.repository }}-en-
7465
7566
- name: Install Python dependencies
7667
run: |
@@ -91,6 +82,11 @@ jobs:
9182
tar -czvf offline.tar.gz site
9283
zip -r -q offline.zip site
9384
85+
- uses: actions/cache/save@v4.0.2
86+
with:
87+
key: site-cache-${{ github.repository }}-en-${{ github.ref }}-${{ hashfiles('.cache/**') }}
88+
path: .cache
89+
9490
- name: Upload tar.gz file
9591
uses: actions/upload-artifact@v4
9692
with:
@@ -114,32 +110,5 @@ jobs:
114110
- name: Upload ZIM file
115111
uses: actions/upload-artifact@v4
116112
with:
117-
name: privacy_guides.zim
118-
path: privacy_guides.zim
119-
120-
release:
121-
name: Create release notes
122-
needs: build
123-
runs-on: ubuntu-latest
124-
permissions:
125-
contents: write
126-
127-
steps:
128-
- uses: actions/download-artifact@v4
129-
with:
130-
name: offline.tar.gz
131-
132-
- uses: actions/download-artifact@v4
133-
with:
134-
name: offline.zip
135-
136-
- uses: actions/download-artifact@v4
137-
with:
138-
name: privacy_guides.zim
139-
140-
- name: Create release notes
141-
uses: ncipollo/release-action@v1
142-
with:
143-
generateReleaseNotes: true
144-
token: ${{ secrets.REPO_TOKEN }}
145-
artifacts: "offline.zip,offline.tar.gz,privacy_guides.zim"
113+
name: offline-privacy_guides.zim
114+
path: offline-privacy_guides.zim

.github/workflows/build.yml

Lines changed: 41 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -30,75 +30,90 @@ on:
3030
required: true
3131
type: string
3232
lang:
33-
required: true
3433
type: string
35-
i18n:
36-
required: true
34+
default: en
35+
context:
36+
type: string
37+
default: deploy-preview
38+
continue-on-error:
3739
type: boolean
40+
default: true
41+
42+
permissions:
43+
contents: read
3844

3945
jobs:
4046
build:
4147
runs-on: ubuntu-latest
42-
continue-on-error: ${{ inputs.i18n }}
48+
continue-on-error: ${{ inputs.continue-on-error }}
4349
permissions:
4450
contents: read
4551

4652
steps:
47-
- name: Checkout repository
48-
uses: actions/checkout@v4
53+
- uses: actions/checkout@v4
4954
with:
5055
repository: ${{ inputs.repo }}
5156
ref: ${{ inputs.ref }}
5257
persist-credentials: 'false'
5358

5459
- uses: actions/download-artifact@v4
5560
with:
61+
pattern: repo-*
5662
path: modules
5763

5864
- run: |
5965
rmdir modules/mkdocs-material
60-
mv modules/mkdocs-material-insiders modules/mkdocs-material
66+
mv modules/repo-mkdocs-material-insiders modules/mkdocs-material
6167
rmdir theme/assets/brand
62-
mv modules/brand theme/assets/brand
68+
mv modules/repo-brand theme/assets/brand
6369
64-
- if: inputs.i18n
70+
- if: inputs.lang != 'en'
6571
run: |
66-
cp -rl modules/i18n/i18n .
67-
cp -rl modules/i18n/includes .
68-
cp -rl modules/i18n/theme .
72+
cp -rl modules/repo-i18n/i18n .
73+
cp -rl modules/repo-i18n/includes .
74+
cp -rl modules/repo-i18n/theme .
6975
70-
- name: Python setup
71-
uses: actions/setup-python@v5
76+
- uses: actions/setup-python@v5
7277
with:
7378
python-version: '3.8'
7479
cache: 'pipenv'
7580

76-
- name: Cache files
77-
uses: actions/cache@v4.0.2
81+
- uses: actions/cache/restore@v4.0.2
7882
with:
79-
key: ${{ inputs.ref }}
83+
key: site-cache-${{ inputs.repo }}-${{ inputs.lang }}-${{ inputs.ref }}-${{ hashfiles('.cache/**') }}
8084
path: .cache
85+
restore-keys: |
86+
site-cache-${{ inputs.repo }}-${{ inputs.lang }}-${{ inputs.ref }}-
87+
site-cache-${{ inputs.repo }}-${{ inputs.lang }}-
88+
site-cache-${{ github.repository }}-${{ inputs.lang }}
8189
82-
- name: Install Python dependencies
83-
run: |
90+
- run: |
8491
pip install pipenv
8592
pipenv install
8693
sudo apt install pngquant
8794
88-
- name: Build website
89-
env:
95+
- if: inputs.lang != 'en'
96+
uses: falti/dotenv-action@v1.1
97+
with:
98+
path: includes/strings.${{ inputs.lang }}.env
99+
export-variables: true
100+
101+
- env:
90102
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
91-
CARDS: false
92-
CONTEXT: deploy-preview
93-
NETLIFY: true
103+
CONTEXT: ${{ inputs.context }}
104+
PRODUCTION: true
94105
run: |
95106
pipenv run mkdocs build --config-file config/mkdocs.${{ inputs.lang }}.yml
96107
cp -r static/* site/
97108
pipenv run mkdocs --version
98109
tar -czvf site-build-${{ inputs.lang }}.tar.gz site
99110
100-
- name: Upload tar.gz file
101-
uses: actions/upload-artifact@v4
111+
- uses: actions/cache/save@v4.0.2
112+
with:
113+
key: site-cache-${{ inputs.repo }}-${{ inputs.lang }}-${{ inputs.ref }}-${{ hashfiles('.cache/**') }}
114+
path: .cache
115+
116+
- uses: actions/upload-artifact@v4
102117
with:
103118
name: site-build-${{ inputs.lang }}.tar.gz
104119
path: site-build-${{ inputs.lang }}.tar.gz

.github/workflows/cleanup.yml

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -24,26 +24,10 @@ on:
2424
workflow_call:
2525

2626
jobs:
27-
brand:
27+
cleanup:
2828
runs-on: ubuntu-latest
2929
steps:
3030
- uses: geekyeggo/delete-artifact@v5
3131
with:
32-
name: brand
33-
failOnError: false
34-
35-
i18n:
36-
runs-on: ubuntu-latest
37-
steps:
38-
- uses: geekyeggo/delete-artifact@v5
39-
with:
40-
name: i18n
41-
failOnError: false
42-
43-
mkdocs-material-insiders:
44-
runs-on: ubuntu-latest
45-
steps:
46-
- uses: geekyeggo/delete-artifact@v5
47-
with:
48-
name: mkdocs-material-insiders
32+
name: repo-*
4933
failOnError: false

0 commit comments

Comments
 (0)