Merge pull request #2195 from laws-africa/date-filter #1354
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: Build | |
on: | |
push: | |
branches: | |
- main | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
name: Compile javascript and commit changes | |
# avoid circular build commits | |
if: ${{ !contains(github.event.head_commit.message, 'nobuild') }} | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
# use a token that has admin perms to bypass direct commits to master | |
token: ${{ secrets.LA_ACTIONS_TOKEN }} | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: '18' | |
- name: Install dependencies | |
run: npm ci --no-audit --prefer-offline --ignore-scripts | |
- name: Build | |
run: npx webpack --mode production | |
env: | |
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }} | |
# sentry's webpack plugin will always update the compiled javascript, even if nothing has changed, which makes | |
# caching a bit useless. So, we must compare the compiled javascript to the previous commit to see if anything | |
# has changed, but ignore the bits that sentry adds | |
- name: Check for compiled JS changes | |
id: check_js_changed | |
# this exits with 10 (ie "error") if there IS a change | |
run: scripts/check-js-changed.sh | |
continue-on-error: true | |
- name: Push | |
uses: EndBug/add-and-commit@v9 | |
if: steps.check_js_changed.outcome == 'failure' | |
with: | |
# this must be a string, so we need the | at the start | |
# see https://github.com/EndBug/add-and-commit?tab=readme-ov-file#array-inputs | |
add: | | |
- peachjam/static/js/*app-prod.js --force | |
- peachjam/static/js/*app-prod.js.map --force | |
- peachjam/static/js/pdf.worker-prod.js --force | |
- peachjam/static/js/pdf.worker-prod.js.map --force | |
message: 'Update compiled javascript [nobuild]' |