From 91127201407f13514f7b7ababc1844be9507e2d8 Mon Sep 17 00:00:00 2001 From: Jonah Aragon Date: Sat, 11 Mar 2023 13:29:07 -0600 Subject: [PATCH] Enable offline builds (#2087) --- .github/workflows/pages.yml | 9 --- .github/workflows/release.yml | 59 ++++++++++++++- config/mkdocs.offline.yml | 139 ++++++++++++++++++++++++++++++++++ theme/main.html | 6 ++ theme/overrides/home.en.html | 4 +- 5 files changed, 203 insertions(+), 14 deletions(-) create mode 100644 config/mkdocs.offline.yml diff --git a/.github/workflows/pages.yml b/.github/workflows/pages.yml index abb5c900..96890a34 100644 --- a/.github/workflows/pages.yml +++ b/.github/workflows/pages.yml @@ -23,8 +23,6 @@ jobs: uses: actions/checkout@v3 with: fetch-depth: '0' - ref: ${{github.event.pull_request.head.ref}} - repository: ${{github.event.pull_request.head.repo.full_name}} ssh-key: ${{ secrets.ACTIONS_SSH_KEY }} submodules: 'true' @@ -56,14 +54,7 @@ jobs: pipenv run mkdocs build --config-file config/mkdocs.fr.yml pipenv run mkdocs build --config-file config/mkdocs.he.yml pipenv run mkdocs build --config-file config/mkdocs.nl.yml - mv .well-known site/ pipenv run mkdocs --version - - - name: Matrix homeserver configuration - run: | - mkdir -p site/.well-known/matrix - curl -o site/.well-known/matrix/server https://matrix.privacyguides.org/.well-known/matrix/server - curl -o site/.well-known/matrix/client https://matrix.privacyguides.org/.well-known/matrix/client - name: Package website uses: actions/upload-pages-artifact@v1 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 18d14ff7..16a5e7cc 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -6,14 +6,67 @@ on: - '*' jobs: - release: + build: name: Create Release runs-on: ubuntu-latest permissions: contents: write + steps: - - uses: actions/checkout@v3 - - uses: ncipollo/release-action@v1 + - name: Checkout repository + uses: actions/checkout@v3 + with: + fetch-depth: '0' + ssh-key: ${{ secrets.ACTIONS_SSH_KEY }} + submodules: 'true' + + - name: Pages setup + uses: actions/configure-pages@v3 + + - name: Python setup + uses: actions/setup-python@v4 + with: + python-version: '3.8' + + - name: Cache files + uses: actions/cache@v3.3.0 + with: + key: ${{ github.ref }} + path: .cache + + - name: Install Python dependencies + run: | + pip install pipenv + pipenv install + + - name: Build website + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + CARDS: true + 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 + + - name: Upload tar.gz file + uses: actions/upload-artifact@v3 + with: + name: offline.tar.gz + path: offline.tar.gz + + - name: Upload zip file + uses: actions/upload-artifact@v3 + with: + name: offline.zip + path: offline.zip + + - name: Create release notes + uses: ncipollo/release-action@v1 with: generateReleaseNotes: true token: ${{ secrets.REPO_TOKEN }} + artifacts: "offline.zip,offline.tar.gz" diff --git a/config/mkdocs.offline.yml b/config/mkdocs.offline.yml new file mode 100644 index 00000000..98e08716 --- /dev/null +++ b/config/mkdocs.offline.yml @@ -0,0 +1,139 @@ +INHERIT: mkdocs.common.yml +docs_dir: '../docs' +site_url: "https://www.privacyguides.org/" +site_dir: '../site' + +site_name: Privacy Guides +site_description: | + Privacy Guides is your central privacy and security resource to protect yourself online. +copyright: | + Privacy Guides is a non-profit, socially motivated website that provides information for protecting your data security and privacy.
+ We do not make money from recommending certain products, and we do not use affiliate links.
+ © 2022 Privacy Guides and contributors. + + Content licensed under CC BY-ND 4.0. +repo_url: "" + +extra: + generator: false + analytics: false + alternate: false + offline: true + +theme: + language: en + logo: ../theme/assets/brand/SVG/Logo/privacy-guides-logo-notext-colorbg.svg + font: + text: Public Sans + code: DM Mono + palette: + - media: "(prefers-color-scheme)" + scheme: default + accent: deep purple + toggle: + icon: material/brightness-auto + name: "Switch to dark mode" + - media: "(prefers-color-scheme: dark)" + scheme: slate + accent: amber + toggle: + icon: material/brightness-2 + name: "Switch to light mode" + - media: "(prefers-color-scheme: light)" + scheme: default + accent: deep purple + toggle: + icon: material/brightness-5 + name: "Switch to system theme" + features: + - navigation.tabs + - navigation.sections + - navigation.indexes + - content.tooltips + - search.highlight + +plugins: + offline: + enabled: true + +markdown_extensions: + pymdownx.snippets: + auto_append: + - includes/abbreviations.en.txt + +nav: + - Home: 'index.md' + - Knowledge Base: + - 'basics/threat-modeling.md' + - 'basics/common-threats.md' + - 'basics/common-misconceptions.md' + - 'basics/account-creation.md' + - 'basics/account-deletion.md' + - Technology Essentials: + - 'basics/passwords-overview.md' + - 'basics/multi-factor-authentication.md' + - 'basics/email-security.md' + - 'basics/vpn-overview.md' + - Operating Systems: + - 'os/android-overview.md' + - 'os/linux-overview.md' + - 'os/qubes-overview.md' + - Advanced Topics: + - 'advanced/dns-overview.md' + - 'advanced/tor-overview.md' + - 'advanced/payments.md' + - 'advanced/communication-network-types.md' + - kb-archive.md + - Recommendations: + - 'tools.md' + - Internet Browsing: + - 'tor.md' + - 'desktop-browsers.md' + - 'mobile-browsers.md' + - Operating Systems: + - 'android.md' + - 'desktop.md' + - 'router.md' + - Providers: + - 'cloud.md' + - 'dns.md' + - 'email.md' + - 'financial-services.md' + - 'search-engines.md' + - 'vpn.md' + - Software: + - 'calendar.md' + - 'cryptocurrency.md' + - 'data-redaction.md' + - 'email-clients.md' + - 'encryption.md' + - 'file-sharing.md' + - 'frontends.md' + - 'multi-factor-authentication.md' + - 'news-aggregators.md' + - 'notebooks.md' + - 'passwords.md' + - 'productivity.md' + - 'real-time-communication.md' + - 'video-streaming.md' + - About: + - 'about/index.md' + - 'about/criteria.md' + - 'about/statistics.md' + - 'about/notices.md' + - 'about/privacy-policy.md' + - Community: + - 'about/donate.md' + - Online Services: 'about/services.md' + - Code of Conduct: 'CODE_OF_CONDUCT.md' + - 'about/privacytools.md' + - Contributing: + - Writing Guide: + - 'meta/writing-style.md' + - 'meta/brand.md' + - Technical Guides: + - 'meta/uploading-images.md' + - 'meta/git-recommendations.md' + - Changelog: 'https://github.com/privacyguides/privacyguides.org/releases' + - Forum: 'https://discuss.privacyguides.net/' + - Blog: 'https://blog.privacyguides.org/' diff --git a/theme/main.html b/theme/main.html index 370dea94..2c903b4a 100644 --- a/theme/main.html +++ b/theme/main.html @@ -33,3 +33,9 @@ {% endblock %} +{% block announce %}{% if config.extra.offline %} + You're viewing an offline copy of Privacy Guides built on {{ build_date_utc }}. + + Visit privacyguides.org for the latest version. + +{% else %}{% endif %}{% endblock %} diff --git a/theme/overrides/home.en.html b/theme/overrides/home.en.html index f807e3e8..2ee7a19f 100644 --- a/theme/overrides/home.en.html +++ b/theme/overrides/home.en.html @@ -12,10 +12,10 @@

The guide to restoring your online privacy.

Massive organizations are monitoring your online activities. Privacy Guides is your central privacy and security resource to protect yourself online.

- + Start Your Privacy Journey - + Recommended Tools