Merge pull request #4 from takamatsu-city/takamatsu-manabican-patch-2 #14
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
name: Deploy | |
on: | |
push: | |
branches: [ main ] | |
pull_request: | |
branches: [ main, develop ] | |
workflow_dispatch: | |
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages | |
permissions: | |
contents: write | |
pages: write | |
id-token: write | |
pull-requests: write | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Install dependencies | |
run: npm ci | |
- name: Build the app | |
run: npm run build | |
- name: Add comment to show CSV diff | |
run: npm run csvdiff | |
env: | |
GH_TOKEN: ${{ github.token }} | |
REPO: "${{ github.repository_owner }}/${{ github.event.repository.name }}" | |
- name: Test | |
run: npm test | |
- uses: actions/upload-artifact@v3 | |
if: ${{ github.ref == 'refs/heads/main' }} | |
with: | |
name: build-output | |
path: build/ | |
if-no-files-found: error | |
retention-days: 1 | |
deploy: | |
runs-on: ubuntu-latest | |
needs: build | |
if: ${{ github.ref == 'refs/heads/main' }} | |
steps: | |
- uses: actions/download-artifact@v3 | |
with: | |
name: build-output | |
path: build/ | |
- name: Deploy the app to `gh-pages` | |
uses: peaceiris/actions-gh-pages@v3 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
publish_dir: build | |
publish_branch: gh-pages | |
force_orphan: false # Keep commit logs so that you can track CSV revisions |