-
-
Notifications
You must be signed in to change notification settings - Fork 210
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'privacyguides:main' into pr-vpn
- Loading branch information
Showing
42 changed files
with
1,008 additions
and
4,124 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,49 @@ | |
# 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 +81,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: | ||
|
@@ -109,37 +104,10 @@ jobs: | |
image: ghcr.io/openzim/zim-tools:3.1.3 | ||
options: -v ${{ github.workspace }}:/data | ||
run: | | ||
zimwriterfs -w index.html -I assets/brand/logos/png/square/pg-yellow.png -l eng -t "Privacy Guides" -d "Your central privacy and security resource to protect yourself online." -c "Privacy Guides" -p "Jonah Aragon" -n "Privacy Guides" -e "https://github.com/privacyguides/privacyguides.org" /data/site /data/privacy_guides.zim | ||
zimwriterfs -w index.html -I assets/brand/logos/png/square/pg-yellow.png -l eng -t "Privacy Guides" -d "Your central privacy and security resource to protect yourself online." -c "Privacy Guides" -p "Jonah Aragon" -n "Privacy Guides" -e "https://github.com/privacyguides/privacyguides.org" /data/site /data/offline-privacy_guides.zim | ||
- 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,107 @@ 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' | ||
fetch-depth: 0 | ||
|
||
- 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.ref }}-${{ hashfiles('.cache/**') }} | ||
path: .cache | ||
restore-keys: | | ||
site-cache-${{ inputs.repo }}-${{ inputs.ref }}- | ||
site-cache-${{ inputs.repo }}- | ||
- name: Install Python dependencies | ||
run: | | ||
- uses: actions/cache/[email protected] | ||
with: | ||
key: card-cache-${{ inputs.repo }}-${{ inputs.lang }}-${{ inputs.ref }}-${{ hashfiles('config/.cache/plugin/social/manifest.json') }} | ||
path: | | ||
config/.cache/plugin/social/manifest.json | ||
config/.cache/plugin/social/assets | ||
restore-keys: | | ||
card-cache-${{ inputs.repo }}-${{ inputs.lang }}-${{ inputs.ref }}- | ||
card-cache-${{ inputs.repo }}-${{ inputs.lang }}- | ||
- 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 | ||
keys-case: bypass | ||
|
||
- 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.ref }}-${{ hashfiles('.cache/**') }} | ||
path: .cache | ||
|
||
- uses: actions/cache/[email protected] | ||
with: | ||
key: card-cache-${{ inputs.repo }}-${{ inputs.lang }}-${{ inputs.ref }}-${{ hashfiles('config/.cache/plugin/social/manifest.json') }} | ||
path: | | ||
config/.cache/plugin/social/manifest.json | ||
config/.cache/plugin/social/assets | ||
- 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.