name: 🥝 Build Zimfile on: workflow_call: inputs: ref: required: true type: string repo: required: true type: string secrets: RO_DISCOURSE_API_KEY: required: false permissions: contents: read env: VIDEOS_SITE_BASE_URL: https://www.privacyguides.org/videos/ HOMEPAGE_CTA_ABOUT_LINK: about.html HOMEPAGE_CTA_DONATE_LINK: about/donate.html BUILD_OFFLINE: true PRODUCTION: true CARDS: false GITREVISIONDATE: false GITAUTHORS: false jobs: package_eng: runs-on: ubuntu-latest permissions: contents: read env: LANGUAGE_SWITCHER: false MAIN_SITE_BASE_URL: /en/index.html MAIN_SITE_ABOUT_URL: /en/about.html MAIN_SITE_RECOMMENDATIONS_URL: /en/tools.html MAIN_SITE_KNOWLEDGE_BASE_URL: /en/basics/why-privacy-matters.html ARTICLES_SITE_BASE_URL: /articles/index.html steps: - name: Add GitHub Token to Environment run: | echo "GH_TOKEN=${{ secrets.GITHUB_TOKEN }}" >> "$GITHUB_ENV" - name: Download Repository uses: actions/checkout@v4 with: repository: ${{ inputs.repo }} ref: ${{ inputs.ref }} persist-credentials: "false" fetch-depth: 0 - name: Download Submodules uses: actions/download-artifact@v4 with: pattern: repo-* path: modules - name: Move mkdocs-material-insiders to mkdocs-material run: | rmdir modules/mkdocs-material mv modules/repo-mkdocs-material-insiders modules/mkdocs-material - name: Move brand submodule to theme/assets/brand run: | rmdir theme/assets/brand mv modules/repo-brand theme/assets/brand - name: Install Python (pipenv) uses: actions/setup-python@v5 with: cache: "pipenv" - name: Install Python Dependencies run: | pip install pipenv pipenv install sudo apt install pngquant - name: Generate Donating Members List continue-on-error: true env: DISCOURSE_API_KEY: ${{ secrets.RO_DISCOURSE_API_KEY }} run: | pip install requests python tools/generate-members.py > includes/members.md - name: Build English run: | ./run.sh --build --production --insiders --offline --lang=en - name: Delete Unreferenced Assets run: | bash tools/delete-unreferenced.sh env: ASSETS_DIR: site/en/assets SEARCH_DIR: site/en - name: Run generate-topics.sh for top posts run: | bash tools/generate-topics.sh \ --source='https://discuss.privacyguides.net/top.json?period=weekly' \ --tag="top posts" \ --destination="./site/en/index.html" \ --count=3 - name: Run generate-topics.sh for latest posts run: | bash tools/generate-topics.sh \ --source='https://discuss.privacyguides.net/latest.json' \ --tag="latest posts" \ --destination="./site/en/index.html" \ --count=12 - name: Build Articles run: | pipenv run mkdocs build --config-file mkdocs.blog.yml - name: Delete Unreferenced Assets run: | bash tools/delete-unreferenced.sh env: ASSETS_DIR: site/articles/assets SEARCH_DIR: site/articles - name: Remove Duplicate Files run: | cd site && bash ../tools/symlink-duplicates.sh ln -s en/index.html index.html ln -s en/about/notices.html license cd .. - name: Set zimfile name run: | echo "ZIMFILE_NAME=privacyguides.org_en_all_$(date +%Y)-$(date +%m).zim" >> "$GITHUB_ENV" - 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 en/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 "Privacy Guides" \ -e "https://www.privacyguides.org" \ -n "privacyguides.org_en_all" \ /data/site/ /data/${{ env.ZIMFILE_NAME }} - name: Upload ZIM File uses: actions/upload-artifact@v4 with: path: ${{ env.ZIMFILE_NAME }} name: ${{ env.ZIMFILE_NAME }} compression-level: 0 - name: Run zimcheck uses: addnab/docker-run-action@v3 continue-on-error: true with: image: ghcr.io/openzim/zim-tools:3.1.3 options: -v ${{ github.workspace }}:/data run: | zimcheck /data/${{ env.ZIMFILE_NAME }} package_eng_kb: runs-on: ubuntu-latest permissions: contents: read env: LANGUAGE_SWITCHER: false ARTICLES_SITE_BASE_URL: https://www.privacyguides.org/articles/ steps: - name: Add GitHub Token to Environment run: | echo "GH_TOKEN=${{ secrets.GITHUB_TOKEN }}" >> "$GITHUB_ENV" - name: Download Repository uses: actions/checkout@v4 with: repository: ${{ inputs.repo }} ref: ${{ inputs.ref }} persist-credentials: "false" fetch-depth: 0 - name: Download Submodules uses: actions/download-artifact@v4 with: pattern: repo-* path: modules - name: Move mkdocs-material-insiders to mkdocs-material run: | rmdir modules/mkdocs-material mv modules/repo-mkdocs-material-insiders modules/mkdocs-material - name: Move brand submodule to theme/assets/brand run: | rmdir theme/assets/brand mv modules/repo-brand theme/assets/brand - name: Install Python (pipenv) uses: actions/setup-python@v5 with: cache: "pipenv" - name: Install Python Dependencies run: | pip install pipenv pipenv install sudo apt install pngquant - name: Generate Donating Members List continue-on-error: true env: DISCOURSE_API_KEY: ${{ secrets.RO_DISCOURSE_API_KEY }} run: | pip install requests python tools/generate-members.py > includes/members.md - name: Build English run: | ./run.sh --build --production --insiders --offline --lang=en - name: Run generate-topics.sh for top posts run: | bash tools/generate-topics.sh \ --source='https://discuss.privacyguides.net/top.json?period=weekly' \ --tag="top posts" \ --destination="./site/en/index.html" \ --count=3 - name: Run generate-topics.sh for latest posts run: | bash tools/generate-topics.sh \ --source='https://discuss.privacyguides.net/latest.json' \ --tag="latest posts" \ --destination="./site/en/index.html" \ --count=12 - name: Delete Unreferenced Assets run: | bash tools/delete-unreferenced.sh env: ASSETS_DIR: site/en/assets SEARCH_DIR: site/en - name: Remove Duplicate Files run: | cd site && bash ../tools/symlink-duplicates.sh ln -s en/index.html index.html ln -s en/about/notices.html license cd .. - name: Set zimfile name run: | echo "ZIMFILE_NAME=privacyguides.org_en_kb_$(date +%Y)-$(date +%m).zim" >> "$GITHUB_ENV" - 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 en/assets/brand/logos/png/square/pg-yellow.png \ -l eng \ -t "Privacy Guides" \ -d "Knowledge base articles and recommendations from Privacy Guides." \ -c "Privacy Guides" \ -p "Privacy Guides" \ -e "https://www.privacyguides.org" \ -n "privacyguides.org_en_kb" \ /data/site/ /data/${{ env.ZIMFILE_NAME }} - name: Upload ZIM File uses: actions/upload-artifact@v4 with: path: ${{ env.ZIMFILE_NAME }} name: ${{ env.ZIMFILE_NAME }} compression-level: 0 - name: Run zimcheck uses: addnab/docker-run-action@v3 continue-on-error: true with: image: ghcr.io/openzim/zim-tools:3.1.3 options: -v ${{ github.workspace }}:/data run: | zimcheck /data/${{ env.ZIMFILE_NAME }} package_eng_articles: runs-on: ubuntu-latest permissions: contents: read env: MAIN_SITE_BASE_URL: https://www.privacyguides.org/en/ MAIN_SITE_ABOUT_URL: https://www.privacyguides.org/en/about/ MAIN_SITE_RECOMMENDATIONS_URL: https://www.privacyguides.org/en/tools/ MAIN_SITE_KNOWLEDGE_BASE_URL: https://www.privacyguides.org/en/basics/ steps: - name: Add GitHub Token to Environment run: | echo "GH_TOKEN=${{ secrets.GITHUB_TOKEN }}" >> "$GITHUB_ENV" - name: Download Repository uses: actions/checkout@v4 with: repository: ${{ inputs.repo }} ref: ${{ inputs.ref }} persist-credentials: "false" fetch-depth: 0 - name: Download Submodules uses: actions/download-artifact@v4 with: pattern: repo-* path: modules - name: Move mkdocs-material-insiders to mkdocs-material run: | rmdir modules/mkdocs-material mv modules/repo-mkdocs-material-insiders modules/mkdocs-material - name: Move brand submodule to theme/assets/brand run: | rmdir theme/assets/brand mv modules/repo-brand theme/assets/brand - name: Install Python (pipenv) uses: actions/setup-python@v5 with: cache: "pipenv" - name: Install Python Dependencies run: | pip install pipenv pipenv install sudo apt install pngquant - name: Build Articles run: | pipenv run mkdocs build --config-file mkdocs.blog.yml - name: Delete Unreferenced Assets run: | bash tools/delete-unreferenced.sh env: ASSETS_DIR: site/articles/assets SEARCH_DIR: site/articles - name: Remove Duplicate Files run: | cd site && bash ../tools/symlink-duplicates.sh ln -s articles/index.html index.html cd .. - name: Set zimfile name run: | echo "ZIMFILE_NAME=privacyguides.org_en_articles_$(date +%Y)-$(date +%m).zim" >> "$GITHUB_ENV" - 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 articles/assets/brand/logos/png/square/pg-yellow.png \ -l eng \ -t "Privacy Guides" \ -d "Long-form articles from the Privacy Guides team and other contributors." \ -c "Privacy Guides" \ -p "Privacy Guides" \ -e "https://www.privacyguides.org" \ -n "privacyguides.org_en_articles" \ /data/site/ /data/${{ env.ZIMFILE_NAME }} - name: Upload ZIM File uses: actions/upload-artifact@v4 with: path: ${{ env.ZIMFILE_NAME }} name: ${{ env.ZIMFILE_NAME }} compression-level: 0 - name: Run zimcheck uses: addnab/docker-run-action@v3 continue-on-error: true with: image: ghcr.io/openzim/zim-tools:3.1.3 options: -v ${{ github.workspace }}:/data run: | zimcheck /data/${{ env.ZIMFILE_NAME }} build_mul: runs-on: ubuntu-latest continue-on-error: true permissions: contents: read env: MAIN_SITE_BASE_URL: /en/index.html MAIN_SITE_ABOUT_URL: /en/about.html MAIN_SITE_RECOMMENDATIONS_URL: /en/tools.html MAIN_SITE_KNOWLEDGE_BASE_URL: /en/basics/why-privacy-matters.html ARTICLES_SITE_BASE_URL: /articles/index.html strategy: matrix: lang: [en, es, fr, he, it, nl, ru, zh-Hant] steps: - name: Add GitHub Token to Environment run: | echo "GH_TOKEN=${{ secrets.GITHUB_TOKEN }}" >> "$GITHUB_ENV" - name: Download Repository uses: actions/checkout@v4 with: repository: ${{ inputs.repo }} ref: ${{ inputs.ref }} persist-credentials: "false" fetch-depth: 0 - name: Download Submodules uses: actions/download-artifact@v4 with: pattern: repo-* path: modules - name: Move mkdocs-material-insiders to mkdocs-material run: | rmdir modules/mkdocs-material mv modules/repo-mkdocs-material-insiders modules/mkdocs-material - name: Move brand submodule to theme/assets/brand run: | rmdir theme/assets/brand mv modules/repo-brand theme/assets/brand - name: Copy Translation Files if: matrix.lang != 'en' run: | cp -rl modules/repo-i18n/i18n . cp -rl modules/repo-i18n/includes . - name: Install Python (pipenv) uses: actions/setup-python@v5 with: cache: "pipenv" - name: Install Python Dependencies run: | pip install pipenv pipenv install sudo apt install pngquant - name: Generate Donating Members List continue-on-error: true env: DISCOURSE_API_KEY: ${{ secrets.RO_DISCOURSE_API_KEY }} run: | pip install requests python tools/generate-members.py > includes/members.md - name: Build Website run: | ./run.sh --build --production --insiders --offline --lang=${{ matrix.lang }} - name: Run generate-topics.sh for top posts if: matrix.lang == 'en' run: | bash tools/generate-topics.sh \ --source='https://discuss.privacyguides.net/top.json?period=weekly' \ --tag="top posts" \ --destination="./site/en/index.html" \ --count=3 - name: Run generate-topics.sh for latest posts if: matrix.lang == 'en' run: | bash tools/generate-topics.sh \ --source='https://discuss.privacyguides.net/latest.json' \ --tag="latest posts" \ --destination="./site/en/index.html" \ --count=12 - name: Delete Unreferenced Assets run: | bash tools/delete-unreferenced.sh env: ASSETS_DIR: site/${{ matrix.lang }}/assets SEARCH_DIR: site/${{ matrix.lang }} - name: Build Articles if: matrix.lang == 'en' run: | pipenv run mkdocs build --config-file mkdocs.blog.yml - name: Delete Unreferenced Assets if: matrix.lang == 'en' run: | bash tools/delete-unreferenced.sh env: ASSETS_DIR: site/articles/assets SEARCH_DIR: site/articles - name: Package Website run: | tar -czf site-zimready-${{ matrix.lang }}.tar.gz site - name: Upload Site uses: actions/upload-artifact@v4 with: name: site-zimready-${{ matrix.lang }}.tar.gz path: site-zimready-${{ matrix.lang }}.tar.gz retention-days: 1 compression-level: 0 package_mul: runs-on: ubuntu-latest needs: [build_mul] permissions: contents: read steps: - name: Download Repository uses: actions/checkout@v4 with: repository: ${{ inputs.repo }} ref: ${{ inputs.ref }} persist-credentials: "false" fetch-depth: 0 - name: Download All Sites uses: actions/download-artifact@v4 with: pattern: site-zimready-* merge-multiple: true - name: List Files (for debugging) run: | for file in *.tar.gz; do tar -zxf "$file"; done ls -la site/ - name: Remove Duplicate Files run: | cd site && bash ../tools/symlink-duplicates.sh ln -s en/index.html index.html ln -s en/about/notices.html license cd .. - name: Set zimfile name run: | echo "ZIMFILE_NAME=privacyguides.org_mul_all_$(date +%Y)-$(date +%m).zim" >> "$GITHUB_ENV" - 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 en/assets/brand/logos/png/square/pg-yellow.png \ -l mul \ -t "Privacy Guides" \ -d "Your central privacy and security resource to protect yourself online." \ -c "Privacy Guides" \ -p "Privacy Guides" \ -e "https://www.privacyguides.org" \ -n "privacyguides.org_mul_all" \ /data/site/ /data/${{ env.ZIMFILE_NAME }} - name: Upload ZIM File uses: actions/upload-artifact@v4 with: path: ${{ env.ZIMFILE_NAME }} name: ${{ env.ZIMFILE_NAME }} compression-level: 0 - name: Run zimcheck uses: addnab/docker-run-action@v3 continue-on-error: true with: image: ghcr.io/openzim/zim-tools:3.1.3 options: -v ${{ github.workspace }}:/data run: | zimcheck /data/${{ env.ZIMFILE_NAME }}