Skip to content

Commit

Permalink
Change workflow name and streamline env variables
Browse files Browse the repository at this point in the history
  • Loading branch information
avonbied committed Oct 20, 2024
1 parent e04828f commit 584d057
Showing 1 changed file with 59 additions and 60 deletions.
119 changes: 59 additions & 60 deletions .github/workflows/deploy.yml → .github/workflows/ghpage-deploy.yml
Original file line number Diff line number Diff line change
@@ -1,61 +1,60 @@
name: GitHub Pages CI (Astro)
on:
push:
branches: main
pull_request:
branches: main
workflow_dispatch:

permissions:
contents: read
pages: write
id-token: write

concurrency:
group: "pages"
cancel-in-progress: false

env:
BUILD_PATH: .
SITE_URL: https://avonbied.github.io

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout the repository
uses: actions/checkout@v3
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: lts/hydrogen
cache: 'yarn'
cache-dependency-path: ${{ env.BUILD_PATH }}/*.lock
- name: Setup Pages
id: pages
uses: actions/configure-pages@v3
- name: Install dependencies
run: yarn install
working-directory: ${{ env.BUILD_PATH }}
- name: Build with Astro
run: |
yarn astro build \
--base "${{ steps.pages.outputs.base_path }}"
working-directory: ${{ env.BUILD_PATH }}
env:
SITE_URL: "${{ steps.pages.outputs.origin }}"
- name: Upload artifact
uses: actions/upload-pages-artifact@v1
with:
path: ${{ env.BUILD_PATH }}/dist

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
name: GitHub Pages CI (Astro)
on:
push:
branches: main
pull_request:
branches: main
workflow_dispatch:

permissions:
contents: read
pages: write
id-token: write

concurrency:
group: "pages"
cancel-in-progress: false

env:
BUILD_PATH: .

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout the repository
uses: actions/checkout@v3
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: lts/hydrogen
cache: 'yarn'
cache-dependency-path: ${{ env.BUILD_PATH }}/*.lock
- name: Setup Pages
id: pages
uses: actions/configure-pages@v3
- name: Install dependencies
run: yarn install
working-directory: ${{ env.BUILD_PATH }}
- name: Build with Astro
env:
SITE_URL: "${{ steps.pages.outputs.origin }}"
SITE_BASE: "${{ steps.pages.outputs.base_path }}"
run: |
yarn astro build
working-directory: ${{ env.BUILD_PATH }}
- name: Upload artifact
uses: actions/upload-pages-artifact@v1
with:
path: ${{ env.BUILD_PATH }}/dist

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@v1

0 comments on commit 584d057

Please sign in to comment.