Skip to content

update

update #36

Workflow file for this run

# Manually pull latest data, build the site, and commit.
name: update
on:
workflow_dispatch:
schedule:
- cron: '0 9 * * 1' # Runs every Monday at 9 AM UTC (4 AM CT during standard time, 3 AM CT during daylight saving time).
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'
- 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
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 -r data/csv release/csv
cp -r 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
tag_name: ${{ env.TAG_NAME }}
- 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.'
tag_name: ${{ env.TAG_NAME }}
target_commitish: ${{ env.DATA_BRANCH_SHA }}
- name: Delete release folder before deployment to Azure
run: rm -r release
- 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 }}