mirror of
https://github.com/djkotowski/personal-website.git
synced 2026-09-12 05:20:40 -05:00
* Use safe concurrency pattern for Pages deploys Switch to the group: pages, cancel-in-progress: false pattern GitHub recommends for deploy-pages, so a superseded run is skipped before it starts rather than killed mid-deploy, which can leave the Pages deployment stuck in progress. * Tag each successful Pages deploy There is currently no record of which commits were actually deployed. Tag the deployed commit as deploy-YYYY-MM-DD-<sha> right after deploy-pages succeeds, giving a lightweight, always-unique history of production deploys without introducing a formal versioning/release scheme.
54 lines
1.4 KiB
YAML
54 lines
1.4 KiB
YAML
name: deploy
|
|
run-name: "${{ github.actor }} is deploying ${{ github.sha }}"
|
|
on:
|
|
push:
|
|
branches:
|
|
- 'main'
|
|
concurrency:
|
|
group: pages
|
|
cancel-in-progress: false
|
|
jobs:
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v7
|
|
- name: Setup pnpm
|
|
uses: pnpm/action-setup@v5
|
|
- name: Setup Node.js
|
|
uses: actions/setup-node@v7
|
|
with:
|
|
node-version-file: '.tool-versions'
|
|
cache: 'pnpm'
|
|
- name: Install Dependencies
|
|
run: pnpm install --frozen-lockfile
|
|
- name: Build solution
|
|
run: pnpm build
|
|
- name: Archive artifacts
|
|
uses: actions/[email protected]
|
|
with:
|
|
path: dist/
|
|
deploy:
|
|
needs: build
|
|
permissions:
|
|
pages: write
|
|
id-token: write
|
|
contents: write
|
|
environment:
|
|
name: github-pages
|
|
url: ${{ steps.deployment.outputs.page_url }}
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v7
|
|
- name: Deploy to GitHub Pages
|
|
id: deployment
|
|
uses: actions/deploy-pages@v5
|
|
- name: Tag deploy
|
|
run: |
|
|
git config user.name "github-actions[bot]"
|
|
git config user.email "github-actions[bot]@users.noreply.github.com"
|
|
tag="deploy-$(date +%Y-%m-%d)-${GITHUB_SHA::7}"
|
|
git tag "$tag"
|
|
git push origin "$tag"
|