update #19
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
# Manually pull latest data, build the site, and commit. | |
name: update | |
on: | |
workflow_dispatch: | |
env: | |
DRIVE_CREDENTIALS: ${{ secrets.DRIVE_CREDENTIALS }} | |
NODE_ENV: CI | |
PORT: 3000 | |
permissions: | |
contents: write | |
jobs: | |
update: | |
runs-on: ubuntu-latest | |
environment: | |
name: 'Production' | |
url: ${{ steps.deploy-to-webapp.outputs.webapp-url }} | |
steps: | |
- name: Check out repo | |
uses: actions/checkout@v4 | |
- name: Set up Node | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '20.x' | |
# TODO: Cache dependencies | |
- name: Install dependencies | |
run: npm ci | |
# - name: Update bibliography | |
# run: node bin/updateBibliography.js | |
# - name: Update database | |
# run: node bin/updateDatabase.js | |
- name: Build app | |
run: npm run build | |
# - name: Check for "only" in tests | |
# run: npm run stop-only | |
# - name: Run E2E tests | |
# run: npm test | |
- name: Commit changes | |
run: | | |
git config user.name "github-actions[bot]" | |
git config user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
git add . | |
git commit -m "Update data" | |
git push | |
- name: Increment version | |
run: | | |
npm version patch | |
git push | |
git push --tags | |
echo "TAG_NAME=$(git describe --tags --abbrev=0)" >> $GITHUB_ENV | |
- name: Copy release data into its own folder | |
run: | | |
mkdir release | |
cp data/README.md release/README.md | |
cp data/csv release/csv | |
cp data/json release/json | |
- name: Copy release data to data branch | |
uses: peaceiris/actions-gh-pages@v4 | |
with: | |
enable_jekyll: true | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
publish_branch: data | |
publish_dir: release | |
- name: Get SHA of data branch | |
run: echo "DATA_BRANCH_SHA=$(git rev-parse data)" >> $GITHUB_ENV | |
- name: Create a Zenodo release | |
uses: softprops/action-gh-release@v2 | |
with: | |
body: 'This is a release to archive data with Zenodo.' | |
draft: true | |
fail_on_unmatched_files: true | |
# files: | | |
# data/README.md | |
# data/csv/** | |
# data/json/** | |
tag_name: ${{ env.TAG_NAME }} | |
target_commitish: ${{ env.DATA_BRANCH_SHA }} | |
# - name: Deploy to Azure Web App | |
# id: deploy-to-webapp | |
# uses: azure/webapps-deploy@v2 | |
# with: | |
# app-name: nisinoon | |
# slot-name: Production | |
# package: . | |
# publish-profile: ${{ secrets.AZUREAPPSERVICE_PUBLISHPROFILE_C789F3DAFFFF45EA89AA17889914203C }} |