Update gtat config #14
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: π CD | β‘οΈ VitePress | |
on: | |
push: | |
branches: | |
- gh-pages | |
paths-ignore: | |
- README.md | |
- LICENSE.md | |
# Allows you to run this workflow manually from the Actions tab | |
workflow_dispatch: | |
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages | |
permissions: | |
pages: write | |
contents: write | |
id-token: write | |
concurrency: | |
group: pages | |
cancel-in-progress: false | |
jobs: | |
cleanup: | |
name: π§Ή Clean up GitHub repo | |
runs-on: ubuntu-latest | |
permissions: write-all | |
steps: | |
- name: π Delete deployment | |
uses: strumwolf/delete-deployment-environment@v3 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
environment: github-pages | |
onlyRemoveDeployments: true | |
- name: π Delete workflow runs | |
uses: dmvict/clean-workflow-runs@v1 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
save_period: 7 | |
save_min_runs_number: 1 | |
branch: gh-pages | |
build: | |
name: ποΈ Build | |
needs: cleanup | |
runs-on: ubuntu-latest | |
environment: | |
name: github-pages | |
steps: | |
- name: ποΈ Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: π§ Setup pnpm | |
uses: pnpm/action-setup@v4 | |
- name: βοΈ Setup Node.js | |
uses: actions/setup-node@v4 | |
timeout-minutes: 5 | |
with: | |
cache: pnpm | |
node-version: 20.x | |
- name: π¦ Install dependencies | |
env: | |
PNPM_FLAGS: --frozen-lockfile --color=always | |
run: pnpm i ${{ env.PNPM_FLAGS }} | |
- name: β‘οΈ Build site with VitePress | |
run: pnpm notes:build | |
env: | |
VITE_GTAG: ${{ vars.VITE_GTAG }} | |
- name: π€ Upload artifact | |
uses: actions/upload-pages-artifact@v3 | |
with: | |
path: ./dist | |
name: dist | |
deploy: | |
name: π Deploy | |
needs: build | |
runs-on: ubuntu-latest | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
steps: | |
- name: π Deploy to GitHub Pages | |
id: deployment | |
uses: actions/deploy-pages@v4 | |
with: | |
artifact_name: dist |