diff --git a/.github/workflows/build-offline.yml b/.github/workflows/build-offline.yml deleted file mode 100644 index 0f42dc75..00000000 --- a/.github/workflows/build-offline.yml +++ /dev/null @@ -1,93 +0,0 @@ -name: Build Offline Website - -on: - workflow_call: - -permissions: - contents: read - -jobs: - build: - runs-on: ubuntu-latest - permissions: - contents: read - - steps: - - name: Checkout repository - uses: actions/checkout@v4 - with: - persist-credentials: "false" - - - uses: actions/download-artifact@v4 - with: - 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: - cache: "pipenv" - - - uses: actions/cache/restore@v4.0.2 - with: - 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: | - pip install pipenv - pipenv install - sudo apt install pngquant - - - name: Build website - env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - CARDS: false - run: | - pipenv run mkdocs build --config-file config/mkdocs-offline.yml - pipenv run mkdocs --version - - - name: Package website - run: | - tar -czvf offline.tar.gz site - zip -r -q offline.zip site - - - uses: actions/cache/save@v4.0.2 - with: - key: site-cache-${{ github.repository }}-en-${{ github.ref }}-${{ hashfiles('.cache/**') }} - path: .cache - - - name: Upload tar.gz file - uses: actions/upload-artifact@v4 - with: - name: offline.tar.gz - path: offline.tar.gz - - - name: Upload zip file - uses: actions/upload-artifact@v4 - with: - name: offline.zip - path: offline.zip - - - name: Create ZIM File - uses: addnab/docker-run-action@v3 - with: - 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/offline-privacy_guides.zim - - - name: Upload ZIM file - uses: actions/upload-artifact@v4 - with: - name: offline-privacy_guides.zim - path: offline-privacy_guides.zim diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 8bb34818..addff401 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -3,9 +3,9 @@ name: Build Website on: workflow_call: inputs: - base_config: + config: type: string - default: mkdocs-production.yml + default: build ref: required: true type: string @@ -33,6 +33,20 @@ jobs: contents: read steps: + - run: | + echo "GH_TOKEN=${{ secrets.GITHUB_TOKEN }}" >> $GITHUB_ENV + + - if: inputs.config == 'build' + run: | + echo "MKDOCS_INHERIT=mkdocs-production.yml" >> $GITHUB_ENV + echo "PRODUCTION=true" >> $GITHUB_ENV + echo "CONTEXT=${{ inputs.context }}" >> $GITHUB_ENV + + - if: inputs.config == 'offline' + run: | + echo "MKDOCS_INHERIT=mkdocs-offline.yml" >> $GITHUB_ENV + echo "CARDS=false" >> $GITHUB_ENV + - uses: actions/checkout@v4 with: repository: ${{ inputs.repo }} @@ -90,15 +104,10 @@ jobs: export-variables: true keys-case: bypass - - env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - CONTEXT: ${{ inputs.context }} - MKDOCS_INHERIT: ${{ inputs.base_config }} - PRODUCTION: true - run: | + - run: | pipenv run mkdocs build --config-file config/mkdocs.${{ inputs.lang }}.yml pipenv run mkdocs --version - tar -czvf site-build-${{ inputs.lang }}.tar.gz site + tar -czvf site-${{ inputs.config }}-${{ inputs.lang }}.tar.gz site - uses: actions/cache/save@v4.0.2 with: @@ -114,5 +123,49 @@ jobs: - uses: actions/upload-artifact@v4 with: - name: site-build-${{ inputs.lang }}.tar.gz - path: site-build-${{ inputs.lang }}.tar.gz + name: site-${{ inputs.config }}-${{ inputs.lang }}.tar.gz + path: site-${{ inputs.config }}-${{ inputs.lang }}.tar.gz + + offline_package: + if: inputs.config == 'offline' && inputs.lang == 'en' + needs: build + runs-on: ubuntu-latest + continue-on-error: ${{ inputs.continue-on-error }} + permissions: + contents: read + + steps: + - uses: actions/download-artifact@v4 + with: + name: site-offline-en.tar.gz + + - run: | + tar -xzvf site-offline-en.tar.gz + tar -czvf offline.tar.gz site/en + zip -r -q offline.zip site/en + + - name: Upload tar.gz file + uses: actions/upload-artifact@v4 + with: + name: offline.tar.gz + path: offline.tar.gz + + - name: Upload zip file + uses: actions/upload-artifact@v4 + with: + name: offline.zip + path: offline.zip + + - name: Create ZIM File + uses: addnab/docker-run-action@v3 + with: + 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/en /data/offline-privacy_guides.zim + + - name: Upload ZIM file + uses: actions/upload-artifact@v4 + with: + name: offline-privacy_guides.zim + path: offline-privacy_guides.zim diff --git a/.github/workflows/publish-release.yml b/.github/workflows/publish-release.yml index 1fa9e417..d5c25113 100644 --- a/.github/workflows/publish-release.yml +++ b/.github/workflows/publish-release.yml @@ -51,25 +51,21 @@ jobs: strategy: matrix: lang: [en, es, fr, he, it, nl, ru, zh-Hant] + build: [build, offline] permissions: contents: read uses: ./.github/workflows/build.yml with: + config: ${{ matrix.build }} ref: ${{ github.ref }} repo: ${{ github.repository }} lang: ${{ matrix.lang }} context: production continue-on-error: false - buildoffline: - needs: submodule - permissions: - contents: read - uses: ./.github/workflows/build-offline.yml - release: name: Create release notes - needs: buildoffline + needs: build runs-on: ubuntu-latest permissions: contents: write @@ -96,8 +92,12 @@ jobs: PROD_MINIO_SECRET_KEY: ${{ secrets.PROD_MINIO_SECRET_KEY }} CF_API_TOKEN: ${{ secrets.CF_API_TOKEN }} CF_ACCOUNT_ID: ${{ secrets.CF_ACCOUNT_ID }} + CLUSTER_USERNAME: ${{ secrets.CLUSTER_USERNAME }} + CLUSTER_PASSWORD: ${{ secrets.CLUSTER_PASSWORD }} + CLOUDFLARE_ZONE: ${{ secrets.CLOUDFLARE_ZONE }} + CLOUDFLARE_TOKEN: ${{ secrets.CLOUDFLARE_TOKEN }} cleanup: if: ${{ always() }} - needs: [build, buildoffline] + needs: build uses: privacyguides/.github/.github/workflows/cleanup.yml@main diff --git a/config/mkdocs-common.yml b/config/mkdocs-common.yml index 2a72b03f..68ae5353 100644 --- a/config/mkdocs-common.yml +++ b/config/mkdocs-common.yml @@ -307,9 +307,7 @@ watch: plugins: tags: {} search: {} - privacy: - assets_exclude: - - cdn.jsdelivr.net/npm/mathjax@3/* + privacy: {} markdown_extensions: admonition: {} diff --git a/config/mkdocs-offline.yml b/config/mkdocs-offline.yml index 4d5dac5c..4c1fe5c6 100644 --- a/config/mkdocs-offline.yml +++ b/config/mkdocs-offline.yml @@ -18,7 +18,7 @@ # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS # IN THE SOFTWARE. -INHERIT: !ENV [MKDOCS_INHERIT, mkdocs-common.yml] +INHERIT: mkdocs-common.yml # Disable any GitHub integrations repo_url: "" @@ -54,8 +54,6 @@ extra: class: md-button theme: - # OFFLINE ONLY: this logo needs to be set separately because the relative path is different - logo: ../theme/assets/brand/logos/svg/logo/privacy-guides-logo-notext-colorbg.svg features: - navigation.tabs - navigation.sections diff --git a/theme/partials/copyright.html b/theme/partials/copyright.html index 4ca43a5f..10ce13ac 100644 --- a/theme/partials/copyright.html +++ b/theme/partials/copyright.html @@ -24,7 +24,7 @@