Skip to content

Instantly share code, notes, and snippets.

@semanticdata
Last active May 3, 2024 13:48
Show Gist options
  • Save semanticdata/17c4a771f9827749fa099c90a09c108a to your computer and use it in GitHub Desktop.
Save semanticdata/17c4a771f9827749fa099c90a09c108a to your computer and use it in GitHub Desktop.
GitHub Workflows
name: Deploy Astro to GitHub Pages
on:
workflow_dispatch:
# push:
# branches: [main]
permissions:
contents: read
pages: write
id-token: write
concurrency:
group: "pages"
cancel-in-progress: true
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Install, build, and upload your site artifact
uses: withastro/action@v2
with:
path: . # Represents root location of Astro project. (optional)
node-version: 18 # Node version to use. (optional)
package-manager: pnpm@latest # Automatically detected based on lockfile. (optional)
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
name: Eleventy Notes - Build and Test (npm)
on:
workflow_dispatch:
pull_request:
# push:
# branches:
# - main
permissions:
contents: read
pages: write
id-token: write
concurrency:
group: "pages"
cancel-in-progress: false
env:
ELEVENTY_NOTES_PATH_PREFIX: "eleventy-notes"
jobs:
build:
runs-on: ubuntu-latest
defaults:
run:
working-directory: .app
steps:
- uses: actions/checkout@v4
name: Checkout
with:
fetch-depth: 0 # Fetch all history for git info
- uses: actions/setup-node@v4
name: Setup Node
with:
node-version: 18
- name: Install dependencies
run: npm install
- name: Build the site
run: npm run build
name: Deploy Eleventy Notes to GitHub Pages (npm)
on:
workflow_dispatch:
push:
branches:
- main
permissions:
contents: read
pages: write
id-token: write
concurrency:
group: "pages"
cancel-in-progress: false
env:
ELEVENTY_NOTES_PATH_PREFIX: "eleventy-notes"
jobs:
build:
runs-on: ubuntu-latest
# defaults:
# run:
# working-directory: .app
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # Fetch all history for git info
- uses: actions/setup-node@v4
with:
node-version: 18
- name: Install dependencies
run: npm install --prefix .app
# run: npm install
- name: Build
run: npm run build --prefix .app
# run: npm run build
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: .app/dist
deploy:
needs: build
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
name: Update Dependencies on Cron
on:
workflow_dispatch:
# pull_request:
# push:
# branches: [main]
# schedule:
# - cron: "0 0 * * *"
jobs:
upgrade:
runs-on: ubuntu-latest
env:
NODE_OPTIONS: "--max_old_space_size=4096"
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup pnpm
uses: pnpm/action-setup@v2
with:
version: 8
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: 18
cache: pnpm
- name: Install dependencies
run: pnpm install
- name: Upgrade Astro
run: pnpm dlx @astrojs/upgrade --yes
- name: PR Changes
uses: peter-evans/create-pull-request@v4
with:
branch: ci/update-astro
commit-message: "ci: update Astro"
assignees: eliancodes
title: "ci: update Astro"
body: Update Astro and packages to latest version
labels: ci
name: Deploy Node to GitHub Pages (npm)
on:
workflow_dispatch:
# push:
# branches:
# - main
permissions:
contents: read
pages: write
id-token: write
concurrency:
group: "pages"
cancel-in-progress: false
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # Fetch all history for git info
- uses: actions/setup-node@v4
with:
node-version: 18
- name: Install dependencies
run: npm i
- name: Build
run: npm run build
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
deploy:
needs: build
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
name: Node - Build and Test (npm)
on:
workflow_dispatch:
pull_request:
# push:
# branches:
# - main
permissions:
contents: read
pages: write
id-token: write
concurrency:
group: "pages"
cancel-in-progress: false
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
name: Checkout
with:
fetch-depth: 0 # Fetch all history for git info
- uses: actions/setup-node@v4
name: Setup Node
with:
node-version: 18
- name: Install dependencies
run: npm install
- name: Build the site
run: npm run build
name: Quartz - Build only
on:
workflow_dispatch:
pull_request:
# push:
# branches:
# - main
permissions:
contents: read
pages: write
id-token: write
concurrency:
group: "pages"
cancel-in-progress: false
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # Fetch all history for git info
- uses: actions/setup-node@v4
with:
node-version: 18
- name: Install Dependencies
run: npm i
- name: Build Quartz
run: npx quartz build
name: Deploy Quartz to GitHub Pages (npm)
on:
workflow_dispatch:
# push:
# branches:
# - main
permissions:
contents: read
pages: write
id-token: write
concurrency:
group: "pages"
cancel-in-progress: false
defaults:
run:
shell: bash
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0 # Fetch all history for git info
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 18
- name: Install Dependencies
run: npm i
- name: Build Quartz
run: npm run build
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: public
deploy:
needs: build
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
name: Deploy Quartz to GitHub Pages (pnpm)
on:
workflow_dispatch:
# push:
# branches:
# - main
permissions:
contents: read
pages: write
id-token: write
concurrency:
group: "pages"
cancel-in-progress: false
defaults:
run:
shell: bash
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0 # Fetch all history for git info
- name: Setup PNPM
uses: pnpm/action-setup@v3
with:
version: 8
- name: Get pnpm store directory
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
- name: Setup pnpm cache
uses: actions/cache@v4
with:
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Install dependencies
run: pnpm install
- name: Build Quartz Site
run: pnpm run build
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: public
deploy:
needs: build
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- name: Deploy to GitHub Pages
uses: actions/deploy-pages@v4
id: deployment
name: Update Dependencies on Cron
on:
schedule:
- cron: "0 0 * * *"
jobs:
upgrade:
runs-on: ubuntu-latest
env:
NODE_OPTIONS: "--max_old_space_size=4096"
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup pnpm
uses: pnpm/action-setup@v2
with:
version: 8
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: 18
cache: pnpm
- name: Install dependencies
run: pnpm install
- name: Upgrade Astro
run: pnpm dlx @astrojs/upgrade --yes
- name: PR Changes
uses: peter-evans/create-pull-request@v4
with:
branch: ci/update-astro
commit-message: "ci: update Astro"
assignees: eliancodes
title: "ci: update Astro"
body: Update Astro and packages to latest version
labels: ci
name: Zola - Build only
on:
# push:
# branches:
# - main
pull_request:
workflow_dispatch:
permissions:
contents: read
pages: write
id-token: write
concurrency:
group: "pages"
cancel-in-progress: false
defaults:
run:
shell: bash
jobs:
build-only:
runs-on: ubuntu-latest
# if: github.ref != 'refs/heads/main'
steps:
- name: Checkout main
uses: actions/checkout@v4
- name: Install Zola
uses: taiki-e/install-action@zola
- name: Build Zola
run: zola check
env:
BUILD_ONLY: true
BUILD_FLAGS: --drafts
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
name: Deploy Zola to GitHub Pages
on:
# push:
# branches:
# - main
# pull_request:
workflow_dispatch:
permissions:
contents: read
pages: write
id-token: write
concurrency:
group: "pages"
cancel-in-progress: false
defaults:
run:
shell: bash
jobs:
build:
runs-on: ubuntu-latest
# if: github.ref != 'refs/heads/main'
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Zola
uses: taiki-e/install-action@zola
- name: Build Zola
run: zola build
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: ./public
deploy:
runs-on: ubuntu-latest
needs: build
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
name: Zola - Build from Docs (folder) and Deploy to GH Pages
on:
# push:
# branches:
# - main
# pull_request:
workflow_dispatch:
permissions:
contents: read
pages: write
id-token: write
concurrency:
group: "pages"
cancel-in-progress: false
defaults:
run:
shell: bash
jobs:
build:
runs-on: ubuntu-latest
# if: github.ref != 'refs/heads/main'
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Zola
uses: taiki-e/install-action@zola
- name: Build Zola
run: zola --root docs build
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: ./docs/public
deploy:
runs-on: ubuntu-latest
needs: build
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment