publish gh-pages #179
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 | |
on: | |
push: | |
branches: | |
- 'main' | |
repository_dispatch: | |
workflow_dispatch: | |
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages | |
permissions: | |
contents: write | |
pages: write | |
id-token: write | |
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 | |
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued. | |
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete. | |
concurrency: | |
group: "pages" | |
cancel-in-progress: true | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
environment: | |
name: github-pages | |
steps: | |
- name: Setup Deno environment | |
uses: denoland/setup-deno@v1 | |
with: | |
deno-version: v1.x | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Cache Deno dependencies | |
uses: actions/cache@v4 | |
with: | |
path: ${{ env.DENO_DIR }} | |
key: ${{ hashFiles('deno.lock') }} | |
- name: Git Config | |
run: | | |
git config user.name ${{ env.GH_BOT_NAME }} | |
git config user.email ${{ env.GH_BOT_EMAIL }} | |
- name: Git Submodule Update | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
git pull --recurse-submodules | |
git submodule update --init --remote --recursive | |
deno task lastmod | |
if git diff --quiet; then | |
echo "-- No changes -- " | |
else | |
git commit -am "π Auto-update submodule references" && git push | |
fi | |
- name: Git Discussion Update | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
deno task activity | |
if git diff --quiet; then | |
echo "-- No changes -- " | |
else | |
git commit -am "π¬ Auto-update GH Activity" && git push | |
fi | |
- 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@v4 | |
- 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 |