Skip to content

Commit

Permalink
Skip GitHub Pages deployment, if GitHub Pages isn't turned on (#2314)
Browse files Browse the repository at this point in the history
This will still go through the motions of building a deployment, but it
won't actually try to deploy.
  • Loading branch information
ddbeck authored Nov 29, 2024
1 parent 6ed6f4f commit f553280
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions .github/workflows/gh-pages-build-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,15 @@ jobs:
# Build the site
build:
runs-on: ubuntu-latest
outputs:
html_url: ${{ steps.pages.outputs.html_url }}
steps:
- name: Get GitHub Pages URL
id: pages
run: echo "html_url=$(gh api '/repos/{owner}/{repo}/pages' | jq '.html_url // false')" >> "$GITHUB_OUTPUT"
env:
GH_REPO: ${{ github.repository }}
GH_TOKEN: ${{ github.token }}
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node
Expand All @@ -48,11 +56,13 @@ jobs:
run: npm run build:prod
working-directory: gh-pages/
- name: Upload artifact
if: ${{ fromJSON(steps.pages.outputs.html_url) }} # Skip if GitHub Pages is not turned on for the current repository
uses: actions/upload-pages-artifact@v3


# Deployment job
deploy:
if: ${{ fromJSON(needs.build.outputs.html_url) }} # Skip if GitHub Pages is not turned on for the current repository
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
Expand Down

0 comments on commit f553280

Please sign in to comment.