Merge pull request #278 from ntt-developers/fix_timetable #48
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 to GitHub Pages | |
on: | |
push: | |
branches: | |
- master | |
env: | |
NODE_VERSION: 20 | |
WORKING_DIRECTORY: "2024" | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
# https://github.com/actions/checkout | |
- uses: actions/checkout@v4 | |
# https://github.com/actions/setup-node | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: ${{ env.NODE_VERSION }} | |
cache: npm | |
cache-dependency-path: ${{ env.WORKING_DIRECTORY }}/package-lock.json | |
- name: npm ci | |
run: npm ci --production | |
working-directory: ${{ env.WORKING_DIRECTORY }} | |
- name: npm run build | |
run: npm run build | |
working-directory: ${{ env.WORKING_DIRECTORY }} | |
# https://github.com/actions/upload-artifact | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: public_${{ github.sha }} | |
path: ${{ env.WORKING_DIRECTORY }}/public/* | |
retention-days: 1 | |
deploy: | |
runs-on: ubuntu-latest | |
needs: | |
- build | |
steps: | |
# https://github.com/actions/checkout | |
- uses: actions/checkout@v4 | |
with: | |
ref: gh-pages | |
- name: git config | |
run: | | |
git config --local user.email "${GITHUB_ACTOR}@users.noreply.github.com" | |
git config --local user.name "${GITHUB_ACTOR}" | |
- name: git checkout | |
run: git checkout ${GITHUB_SHA} README.md | |
- name: rm | |
run: rm -rf ${WORKING_DIRECTORY} | |
# https://github.com/actions/download-artifact | |
- uses: actions/download-artifact@v4 | |
with: | |
name: public_${{ github.sha }} | |
path: ${{ env.WORKING_DIRECTORY }} | |
- name: git add & git commit & git push | |
run: | | |
git add README.md ${WORKING_DIRECTORY} | |
git commit -a --amend -m 'Automatic build by GitHub Actions' | |
git push -fu origin gh-pages |