From c62de5d29fd4b92d78f30d7db7d3815eb7ebf100 Mon Sep 17 00:00:00 2001 From: Jonah Aragon Date: Tue, 26 Apr 2022 13:32:52 -0500 Subject: [PATCH] Use surge.sh for PR previews (#1108) --- .github/workflows/crowdin.yml | 2 +- .github/workflows/deploy.yml | 3 ++- .github/workflows/preview.yml | 50 +++++++++++++++++++++++++++++++++++ 3 files changed, 53 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/preview.yml diff --git a/.github/workflows/crowdin.yml b/.github/workflows/crowdin.yml index 843bd462..f949c44a 100644 --- a/.github/workflows/crowdin.yml +++ b/.github/workflows/crowdin.yml @@ -1,4 +1,4 @@ -name: Crowdin Upload +name: 💬 Crowdin Upload on: push: diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 7cfdd0fc..aa686bc8 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -1,4 +1,5 @@ -name: Deploy Website +name: 📦 Deploy Website + on: workflow_dispatch: release: diff --git a/.github/workflows/preview.yml b/.github/workflows/preview.yml new file mode 100644 index 00000000..59813ec6 --- /dev/null +++ b/.github/workflows/preview.yml @@ -0,0 +1,50 @@ +name: 🔂 Surge PR Preview + +on: + pull_request_target: + types: [opened, synchronize, reopened, closed] + +jobs: + preview: + runs-on: ubuntu-latest + permissions: + issues: write + pull-requests: write + contents: write + environment: preview + steps: + - name: Checkout repository + uses: actions/checkout@v3 + with: + fetch-depth: '0' + ref: ${{github.event.pull_request.head.ref}} + repository: ${{github.event.pull_request.head.repo.full_name}} + + - name: Set up Python runtime + uses: actions/setup-python@v3 + with: + python-version: ${{ env.PYTHON_VERSION }} + + - name: Install Python dependencies + run: | + pip install 'mkdocs>=1.3.0' + pip install mkdocs-static-i18n + pip install mkdocs-git-revision-date-localized-plugin + + - name: Install mkdocs-material Insiders build + if: github.event.repository.fork == false + env: + GH_TOKEN: ${{ secrets.GH_TOKEN }} + run: | + git clone --depth 1 https://${GH_TOKEN}@github.com/privacyguides/mkdocs-material-insiders.git + pip install -e mkdocs-material-insiders + + - name: Deploy to surge.sh + uses: afc163/surge-preview@v1 + with: + surge_token: ${{ secrets.SURGE_TOKEN }} + github_token: ${{ secrets.GITHUB_TOKEN }} + dist: site + teardown: 'true' + build: | + mkdocs build