Skip to content

Commit

Permalink
Merge branch 'privacyguides:main' into pr-vpn
Browse files Browse the repository at this point in the history
  • Loading branch information
friadev authored Apr 1, 2024
2 parents ccd126f + 1372587 commit 702ad17
Show file tree
Hide file tree
Showing 42 changed files with 1,008 additions and 4,124 deletions.
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
Expand All @@ -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: |
Expand All @@ -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:
Expand All @@ -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
86 changes: 59 additions & 27 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
20 changes: 2 additions & 18 deletions .github/workflows/cleanup.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,26 +24,10 @@ on:
workflow_call:

jobs:
brand:
cleanup:
runs-on: ubuntu-latest
steps:
- uses: geekyeggo/delete-artifact@v5
with:
name: brand
failOnError: false

i18n:
runs-on: ubuntu-latest
steps:
- uses: geekyeggo/delete-artifact@v5
with:
name: i18n
failOnError: false

mkdocs-material-insiders:
runs-on: ubuntu-latest
steps:
- uses: geekyeggo/delete-artifact@v5
with:
name: mkdocs-material-insiders
name: repo-*
failOnError: false
Loading

0 comments on commit 702ad17

Please sign in to comment.