-
-
Notifications
You must be signed in to change notification settings - Fork 209
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use GitHub Actions instead of Netlify (#2462)
Signed-off-by: Daniel Gray <[email protected]>
- Loading branch information
1 parent
0b43cb1
commit 353955f
Showing
27 changed files
with
516 additions
and
1,424 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
# Copyright (c) 2021-2023 Jonah Aragon <[email protected]> | ||
# Copyright (c) 2024 Jonah Aragon <[email protected]> | ||
|
||
# Permission is hereby granted, free of charge, to any person obtaining a copy | ||
# of this software and associated documentation files (the "Software"), to | ||
|
@@ -18,59 +18,50 @@ | |
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS | ||
# IN THE SOFTWARE. | ||
|
||
name: 📦 Releases | ||
name: Build Offline Website | ||
|
||
on: | ||
push: | ||
tags: | ||
- '*' | ||
workflow_call: | ||
|
||
permissions: | ||
contents: read | ||
|
||
jobs: | ||
production: | ||
name: Push release to production | ||
build: | ||
runs-on: ubuntu-latest | ||
environment: | ||
name: actions-ssh | ||
permissions: | ||
contents: write | ||
contents: read | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: '0' | ||
ssh-key: ${{ secrets.ACTIONS_SSH_KEY }} | ||
submodules: 'true' | ||
|
||
- name: Push to production branch | ||
run: | | ||
git push origin HEAD:production | ||
persist-credentials: 'false' | ||
|
||
build: | ||
name: Create release packages | ||
runs-on: ubuntu-latest | ||
environment: | ||
name: actions-ssh | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
- uses: actions/download-artifact@v4 | ||
with: | ||
fetch-depth: '0' | ||
ssh-key: ${{ secrets.ACTIONS_SSH_KEY }} | ||
submodules: 'true' | ||
pattern: repo-* | ||
path: modules | ||
|
||
- run: | | ||
rmdir modules/mkdocs-material | ||
mv modules/repo-mkdocs-material-insiders modules/mkdocs-material | ||
rmdir theme/assets/brand | ||
mv modules/repo-brand theme/assets/brand | ||
- name: Python setup | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: '3.8' | ||
cache: 'pipenv' | ||
|
||
- name: Cache files | ||
uses: actions/[email protected] | ||
- uses: actions/cache/[email protected] | ||
with: | ||
key: ${{ github.ref }} | ||
key: site-cache-${{ github.repository }}-en-${{ github.ref }}-${{ hashfiles('.cache/**') }} | ||
path: .cache | ||
restore-keys: | | ||
site-cache-${{ github.repository }}-en-${{ github.ref }}- | ||
site-cache-${{ github.repository }}-en- | ||
- name: Install Python dependencies | ||
run: | | ||
|
@@ -91,6 +82,11 @@ jobs: | |
tar -czvf offline.tar.gz site | ||
zip -r -q offline.zip site | ||
- uses: actions/cache/[email protected] | ||
with: | ||
key: site-cache-${{ github.repository }}-en-${{ github.ref }}-${{ hashfiles('.cache/**') }} | ||
path: .cache | ||
|
||
- name: Upload tar.gz file | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
|
@@ -114,32 +110,5 @@ jobs: | |
- name: Upload ZIM file | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: privacy_guides.zim | ||
path: privacy_guides.zim | ||
|
||
release: | ||
name: Create release notes | ||
needs: build | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: write | ||
|
||
steps: | ||
- uses: actions/download-artifact@v4 | ||
with: | ||
name: offline.tar.gz | ||
|
||
- uses: actions/download-artifact@v4 | ||
with: | ||
name: offline.zip | ||
|
||
- uses: actions/download-artifact@v4 | ||
with: | ||
name: privacy_guides.zim | ||
|
||
- name: Create release notes | ||
uses: ncipollo/release-action@v1 | ||
with: | ||
generateReleaseNotes: true | ||
token: ${{ secrets.REPO_TOKEN }} | ||
artifacts: "offline.zip,offline.tar.gz,privacy_guides.zim" | ||
name: offline-privacy_guides.zim | ||
path: offline-privacy_guides.zim |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,75 +30,90 @@ on: | |
required: true | ||
type: string | ||
lang: | ||
required: true | ||
type: string | ||
i18n: | ||
required: true | ||
default: en | ||
context: | ||
type: string | ||
default: deploy-preview | ||
continue-on-error: | ||
type: boolean | ||
default: true | ||
|
||
permissions: | ||
contents: read | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
continue-on-error: ${{ inputs.i18n }} | ||
continue-on-error: ${{ inputs.continue-on-error }} | ||
permissions: | ||
contents: read | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
- uses: actions/checkout@v4 | ||
with: | ||
repository: ${{ inputs.repo }} | ||
ref: ${{ inputs.ref }} | ||
persist-credentials: 'false' | ||
|
||
- uses: actions/download-artifact@v4 | ||
with: | ||
pattern: repo-* | ||
path: modules | ||
|
||
- run: | | ||
rmdir modules/mkdocs-material | ||
mv modules/mkdocs-material-insiders modules/mkdocs-material | ||
mv modules/repo-mkdocs-material-insiders modules/mkdocs-material | ||
rmdir theme/assets/brand | ||
mv modules/brand theme/assets/brand | ||
mv modules/repo-brand theme/assets/brand | ||
- if: inputs.i18n | ||
- if: inputs.lang != 'en' | ||
run: | | ||
cp -rl modules/i18n/i18n . | ||
cp -rl modules/i18n/includes . | ||
cp -rl modules/i18n/theme . | ||
cp -rl modules/repo-i18n/i18n . | ||
cp -rl modules/repo-i18n/includes . | ||
cp -rl modules/repo-i18n/theme . | ||
- name: Python setup | ||
uses: actions/setup-python@v5 | ||
- uses: actions/setup-python@v5 | ||
with: | ||
python-version: '3.8' | ||
cache: 'pipenv' | ||
|
||
- name: Cache files | ||
uses: actions/[email protected] | ||
- uses: actions/cache/[email protected] | ||
with: | ||
key: ${{ inputs.ref }} | ||
key: site-cache-${{ inputs.repo }}-${{ inputs.lang }}-${{ inputs.ref }}-${{ hashfiles('.cache/**') }} | ||
path: .cache | ||
restore-keys: | | ||
site-cache-${{ inputs.repo }}-${{ inputs.lang }}-${{ inputs.ref }}- | ||
site-cache-${{ inputs.repo }}-${{ inputs.lang }}- | ||
site-cache-${{ github.repository }}-${{ inputs.lang }} | ||
- name: Install Python dependencies | ||
run: | | ||
- run: | | ||
pip install pipenv | ||
pipenv install | ||
sudo apt install pngquant | ||
- name: Build website | ||
env: | ||
- if: inputs.lang != 'en' | ||
uses: falti/[email protected] | ||
with: | ||
path: includes/strings.${{ inputs.lang }}.env | ||
export-variables: true | ||
|
||
- env: | ||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
CARDS: false | ||
CONTEXT: deploy-preview | ||
NETLIFY: true | ||
CONTEXT: ${{ inputs.context }} | ||
PRODUCTION: true | ||
run: | | ||
pipenv run mkdocs build --config-file config/mkdocs.${{ inputs.lang }}.yml | ||
cp -r static/* site/ | ||
pipenv run mkdocs --version | ||
tar -czvf site-build-${{ inputs.lang }}.tar.gz site | ||
- name: Upload tar.gz file | ||
uses: actions/upload-artifact@v4 | ||
- uses: actions/cache/[email protected] | ||
with: | ||
key: site-cache-${{ inputs.repo }}-${{ inputs.lang }}-${{ inputs.ref }}-${{ hashfiles('.cache/**') }} | ||
path: .cache | ||
|
||
- uses: actions/upload-artifact@v4 | ||
with: | ||
name: site-build-${{ inputs.lang }}.tar.gz | ||
path: site-build-${{ inputs.lang }}.tar.gz |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.