Use surge.sh for PR previews (#1108)

This commit is contained in:
Jonah Aragon 2022-04-26 13:32:52 -05:00
parent fce88ba49a
commit c62de5d29f
No known key found for this signature in database
GPG Key ID: E147BA439A59846D
3 changed files with 53 additions and 2 deletions

View File

@ -1,4 +1,4 @@
name: Crowdin Upload name: 💬 Crowdin Upload
on: on:
push: push:

View File

@ -1,4 +1,5 @@
name: Deploy Website name: 📦 Deploy Website
on: on:
workflow_dispatch: workflow_dispatch:
release: release:

50
.github/workflows/preview.yml vendored Normal file
View File

@ -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