Skip to content

Publish to GitHub Pages #3

Publish to GitHub Pages

Publish to GitHub Pages #3

Workflow file for this run

name: Publish to GitHub Pages
on:
pull_request:
workflow_dispatch:
push:
branches:
- main
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read
pages: write
id-token: write
jobs:
build:
name: Build Site
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- uses: actions/setup-node@v4
with:
node-version-file: package.json
- uses: actions/cache@v4
with:
path: |
~/.npm
.techradar
key: ${{ runner.os }}-techradar-${{ hashFiles('**/yarn.lock') }}
- name: Install Dependencies
run: yarn install
- name: Generate Site
run: yarn build
- run: if [ -n "$(git status --porcelain)" ]; then echo 'workspace is dirty after rebuilding' ; git status ; git diff ; exit 1 ; fi
- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
name: build
path: build
publish:
name: Publish to GitHub Pages
if: github.ref_name == 'main'
needs: [ build ]
runs-on: ubuntu-latest
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Download Artifact
uses: actions/download-artifact@v4
with:
name: build
path: build
- name: Configure Pages
uses: actions/configure-pages@983d7736d9b0ae728b81ab479565c72886d7745b # v5
- name: Upload Artifacts
uses: actions/upload-pages-artifact@56afc609e74202658d3ffba0e8f6dda462b719fa # v3
with:
path: build
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@d6db90164ac5ed86f2b6aed7e0febac5b3c0c03e