Skip to content

Commit

Permalink
ci: Use github actions to publish the site directly (#53)
Browse files Browse the repository at this point in the history
* ci: Use github actions to publish the site directly

* fixes

* upgrade action

* set a name

* concurrency
  • Loading branch information
bjchambers authored Jan 31, 2024
1 parent eccd947 commit a4e847a
Showing 1 changed file with 34 additions and 18 deletions.
52 changes: 34 additions & 18 deletions .github/workflows/site.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,13 @@ on:
permissions:
contents: write

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
deploy:
name: Build and (maybe) Deploy Site
build:
name: Build Site
runs-on: ubuntu-latest

steps:
Expand All @@ -36,21 +40,33 @@ jobs:
- name: Build website
run: yarn build
working-directory: docs
- name: Upload docs
uses: actions/upload-pages-artifact@v3
with:
path: docs/build

# Deploy job
deploy:
name: Deploy Site
# Deploy docs on push to main.
if: github.event_name == 'push' && github.ref == 'refs/heads/main'

# Add a dependency to the build job
needs: build

# Popular action to deploy to GitHub Pages:
# Docs: https://github.com/peaceiris/actions-gh-pages#%EF%B8%8F-docusaurus
# Grant GITHUB_TOKEN the permissions required to make a Pages deployment
permissions:
pages: write # to deploy to Pages
id-token: write # to verify the deployment originates from an appropriate source

# Deploy to the github-pages environment
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}

# Specify runner + deployment step
runs-on: ubuntu-latest
steps:
- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v3
# Only run on push to main.
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
# Build output to publish to the `gh-pages` branch:
publish_dir: ./docs/build
# The following lines assign commit authorship to the official
# GH-Actions bot for deploys to `gh-pages` branch:
# https://github.com/actions/checkout/issues/13#issuecomment-724415212
# The GH actions bot is used by default if you didn't specify the two fields.
# You can swap them out with your own user credentials.
user_name: github-actions[bot]
user_email: 41898282+github-actions[bot]@users.noreply.github.com
id: deployment
uses: actions/deploy-pages@v4 # or specific "vX.X.X" version tag for this action

0 comments on commit a4e847a

Please sign in to comment.