publish gh-pages #768
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: publish gh-pages | |
on: | |
workflow_dispatch: | |
workflow_call: | |
env: | |
GH_BOT_EMAIL: "41898282+github-actions[bot]@users.noreply.github.com" | |
GH_BOT_NAME: "GitHub Action" | |
DENO_DIR: .deno-cache | |
REPO: commonhaus/commonhaus.github.io | |
permissions: {} | |
concurrency: | |
group: "pages" | |
cancel-in-progress: true | |
jobs: | |
publish: | |
runs-on: ubuntu-latest | |
environment: | |
name: github-pages | |
permissions: | |
contents: read | |
pages: write | |
id-token: write | |
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued. | |
# Cancel in-progress runs if a new one is queued | |
steps: | |
- name: Setup Deno environment | |
uses: denoland/setup-deno@v2 | |
with: | |
deno-version: v1.x | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
submodules: recursive | |
ref: 'main' | |
- name: Cache Deno dependencies | |
uses: actions/cache@v4 | |
with: | |
path: ${{ env.DENO_DIR }} | |
key: ${{ hashFiles('deno.lock') }} | |
- name: Build site | |
run: deno task build | |
- name: Setup Pages | |
if: github.ref == 'refs/heads/main' && github.repository == ${{ env.REPO }} | |
id: pages | |
uses: actions/configure-pages@v5 | |
- name: Upload artifact | |
if: github.ref == 'refs/heads/main' && github.repository == ${{ env.REPO }} | |
uses: actions/upload-pages-artifact@v3 | |
with: | |
path: ./public | |
- name: Deploy to GitHub Pages | |
if: github.ref == 'refs/heads/main' && github.repository == ${{ env.REPO }} | |
id: deployment | |
uses: actions/deploy-pages@v4 | |
check: | |
runs-on: ubuntu-latest | |
needs: publish | |
if: always() | |
steps: | |
- if: ${{ needs.publish.result != 'failure' }} | |
run: | | |
echo "Deployment successful" | |
- if: ${{ needs.publish.result == 'failure' }} | |
run: | | |
echo "Deployment failed" | |
exit 1 |