Skip to content

Setup GitHub actions #1

Setup GitHub actions

Setup GitHub actions #1

Workflow file for this run

name: Publish to GitHub Pages
on:
workflow_call:
inputs:
destination_dir:
required: true
type: string
secrets:
GITHUB_TOKEN:

Check failure on line 10 in .github/workflows/publish.yml

View workflow run for this annotation

GitHub Actions / .github/workflows/publish.yml

Invalid workflow file

secret name `GITHUB_TOKEN` within `workflow_call` can not be used since it would collide with system reserved name
required: true
jobs:
publish-environment:
name: Publish to GitHub Pages
runs-on: ubuntu-latest
environment: github-pages
permissions:
contents: write
steps:
- name: Ensure `destination_dir` is not empty
if: ${{ inputs.destination_dir == '' }}
run: exit 1
- name: Ensure `publish_dir` is not empty
if: ${{ inputs.publish_dir == '' }}
run: exit 1
- uses: actions/checkout@v3
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version-file: '.nvmrc'
- run: yarn --immutable
- name: Run build script
run: yarn build
- name: Deploy to `${{ inputs.destination_dir }}` directory of `gh-pages` branch
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./public
destination_dir: ${{ inputs.destination_dir }}