use common npx stable version syntax #9
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
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions | |
# This workflow will build and deploy new commits with changes in docs directory to GitHub pages | |
name: Build and Deploy Docs | |
on: | |
workflow_dispatch: | |
push: | |
branches: [main] | |
paths: [docs/**] | |
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages | |
permissions: | |
contents: read | |
pages: write | |
id-token: write | |
# Allow one concurrent deployment | |
concurrency: | |
group: pages | |
cancel-in-progress: true | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
working-directory: docs | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup Ruby | |
uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: "3.3" | |
bundler-cache: true # runs 'bundle install' and caches installed gems automatically | |
working-directory: docs | |
- name: Setup Pages | |
id: pages | |
uses: actions/configure-pages@v5 | |
- name: Build with Jekyll | |
# Outputs to the 'docs/_site' directory | |
run: | | |
echo "url: $GITHUB_PAGES_ORIGIN" > _config.dynamic.yml | |
bundle exec jekyll build --baseurl "${{ steps.pages.outputs.base_path }}" --config _config.yml,_config.dynamic.yml | |
env: | |
JEKYLL_ENV: production | |
GITHUB_PAGES_ORIGIN: ${{ steps.pages.outputs.origin }} | |
- name: Upload artifact | |
# Uploads artifact from the 'docs/_site' directory | |
uses: actions/upload-pages-artifact@v3 | |
with: | |
path: docs/_site | |
deploy: | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
runs-on: ubuntu-latest | |
needs: build | |
steps: | |
- name: Deploy to GitHub Pages | |
id: deployment | |
uses: actions/deploy-pages@v4 |