-
Notifications
You must be signed in to change notification settings - Fork 173
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
10abe1e
commit 85fe821
Showing
3 changed files
with
116 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
name: Build | ||
|
||
on: | ||
workflow_call: | ||
|
||
jobs: | ||
prepare: | ||
name: Prepare | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Use Node.js | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version-file: '.nvmrc' | ||
cache: 'yarn' | ||
- name: Install Yarn dependencies | ||
run: yarn --immutable | ||
|
||
build: | ||
name: Build | ||
runs-on: ubuntu-latest | ||
needs: | ||
- prepare | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Use Node.js | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version-file: '.nvmrc' | ||
cache: 'yarn' | ||
- run: yarn --immutable --immutable-cache | ||
- run: yarn build | ||
- name: Require clean working directory | ||
shell: bash | ||
run: | | ||
if ! git diff --exit-code; then | ||
echo "Working tree dirty at end of job" | ||
exit 1 | ||
fi |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
name: Main | ||
|
||
on: | ||
push: | ||
branches: [main] | ||
pull_request: | ||
|
||
jobs: | ||
check-workflows: | ||
name: Check workflows | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Download actionlint | ||
id: download-actionlint | ||
run: bash <(curl https://raw.githubusercontent.com/rhysd/actionlint/7fdc9630cc360ea1a469eed64ac6d78caeda1234/scripts/download-actionlint.bash) 1.6.23 | ||
shell: bash | ||
- name: Check workflow files | ||
run: ${{ steps.download-actionlint.outputs.executable }} -color | ||
shell: bash | ||
|
||
build: | ||
name: Build | ||
uses: ./.github/workflows/build.yml | ||
|
||
publish-to-gh-pages: | ||
needs: build | ||
if: github.ref == 'refs/heads/main' | ||
name: Publish to the `gh-pages` branch | ||
permissions: | ||
contents: write | ||
uses: ./.github/workflows/publish.yml | ||
with: | ||
destination_dir: ./ | ||
secrets: | ||
PUBLISH_DOCS_TOKEN: ${{ secrets.PUBLISH_DOCS_TOKEN }} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
name: Publish to GitHub Pages | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
destination_dir: | ||
required: true | ||
type: string | ||
secrets: | ||
GITHUB_TOKEN: | ||
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 }} |