Skip to content

Merge branch 'main' into deploy #776

Merge branch 'main' into deploy

Merge branch 'main' into deploy #776

Workflow file for this run

name: Smoketest
on:
push:
pull_request:
workflow_dispatch:
env:
NODE_VERSION: 20.x
jobs:
formatting:
runs-on: ubuntu-latest
name: Verify formatting
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Use Node.js ${{ env.NODE_VERSION }}
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: 'yarn'
- name: Install dependencies
run: |
yarn install --immutable
- name: Verify formatting
run: yarn format:check
build:
name: Build site
runs-on: ubuntu-latest
needs: [formatting]
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
persist-credentials: false
fetch-depth: 0
- name: Use Node.js ${{ env.NODE_VERSION }}
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: 'yarn'
- name: Setup Pages
id: pages
uses: actions/configure-pages@v4
if: github.ref == 'refs/heads/deploy' && github.event_name == 'push'
with:
static_site_generator: gatsby
- name: Install dependencies
run: |
yarn install --immutable
- name: Restore Gatsby cache
uses: actions/cache@v3
id: gatsbyCache
with:
path: ./.cache
key: ${{ runner.os }}-gatsby-cache-${{ hashFiles('public') }}
restore-keys: |
${{ runner.os }}-gatsby-cache-
- name: Build site
run: yarn build:ci
env:
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
- name: Publish Sentry release
if: github.ref == 'refs/heads/deploy' && github.event_name == 'push'
env:
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
SENTRY_ORG: davw-network
SENTRY_PROJECT: rail-announcements-web
run: |
VERSION=`yarn sentry-cli --url https://sentry.service.davw.network releases propose-version`
yarn sentry-cli --url https://sentry.service.davw.network releases new "$VERSION"
yarn sentry-cli --url https://sentry.service.davw.network releases set-commits "$VERSION" --auto
yarn sentry-cli --url https://sentry.service.davw.network releases finalize "$VERSION"
- name: Upload artifact
uses: actions/upload-pages-artifact@v2
with:
path: ./public
# Deploy job
deploy:
# Add a dependency to the build job
needs: build
if: github.ref == 'refs/heads/deploy' && github.event_name == 'push'
# Grant GITHUB_TOKEN the permissions required to make a Pages deployment
permissions:
pages: write # to deploy to Pages
id-token: write # to verify the deployment originates from an appropriate source
actions: read
# Deploy to the github-pages environment
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
# Specify runner + deployment step
runs-on: ubuntu-latest
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v3