Skip to content

Introduce next-gen status page #180

Introduce next-gen status page

Introduce next-gen status page #180

Workflow file for this run

name: Build and deploy to Github Pages
on:
push:
branches:
- main
pull_request:
workflow_dispatch:
concurrency: provision_concurrency_group-${{ github.event.pull_request.number || github.ref_name }}
env:
# This is used during the build step (vite.config.js) to determine the base URL.
# https://vitejs.dev/guide/static-deploy#github-pages
DEPLOY_PATH: ${{ github.ref_name == 'main' && '/' || format('/previews/pr-{0}/{1}...{2}', github.event.pull_request.number, github.event.pull_request.base.sha, github.event.pull_request.head.sha) }}
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Node
uses: actions/setup-node@v2
with:
node-version: 'lts/*'
cache: 'npm'
- name: Build
run: |
npm ci
npm run build
- name: Upload build output
uses: actions/upload-artifact@v3
with:
name: build-output
path: ./dist
deploy_prod:
runs-on: ubuntu-latest
if: github.ref_name == 'main'
needs: [build]
concurrency: deploy_prod_concurrency_group
steps:
- uses: actions/checkout@v2
- name: Download build output
uses: actions/download-artifact@v3
with:
name: build-output
path: ./dist
- name: Set up mutex
uses: ben-z/[email protected]
with:
branch: mutex-gh-pages
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Deploy
uses: JamesIves/[email protected]
with:
branch: gh-pages
folder: ./dist
clean-exclude: previews/*
deploy_preview:
runs-on: ubuntu-latest
if: github.event_name == 'pull_request'
needs: [build]
# Specify write permissions explicitly to make dependabot PRs happy:
# https://github.com/dependabot/dependabot-core/issues/3253#issuecomment-940182533
# This is okay in this job because we don't execute any external code (e.g. npm export).
permissions:
contents: write
pull-requests: write
steps:
- uses: actions/checkout@v2
- name: Download build output
uses: actions/download-artifact@v3
with:
name: build-output
path: ./dist
- name: Set up mutex
uses: ben-z/[email protected]
with:
branch: mutex-gh-pages
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Deploy to Preview Environment
uses: JamesIves/[email protected]
with:
branch: gh-pages
folder: ./dist
target-folder: '.${{ env.DEPLOY_PATH }}'
- name: Create comment
uses: peter-evans/create-or-update-comment@v2
with:
issue-number: ${{ github.event.pull_request.number }}
body: |
I'm deploying a preview of [${{ github.event.pull_request.base.sha }}...${{ github.event.pull_request.head.sha }}][compare].
It will be ready in about a minute. [You can view it here][preview].
[compare]: ${{ github.event.pull_request.head.repo.html_url }}/compare/${{ github.event.pull_request.base.sha }}...${{ github.event.pull_request.head.sha }}
[preview]: ${{ github.event.pull_request.head.repo.homepage }}${{ env.DEPLOY_PATH }}