Build Updated Distributable #785
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 Updated Distributable | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- '2.x' | |
paths-ignore: | |
- '**.md' | |
schedule: | |
- cron: '0 0 * * *' # Run at 00:00 UTC | |
permissions: | |
contents: write | |
pull-requests: write | |
jobs: | |
check-dist: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Set Node 20 | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '20.x' | |
- name: Cache dependencies | |
id: cache-npm | |
uses: actions/cache@v4 | |
with: | |
path: ~/.npm | |
key: ${{ github.job }}-npm-${{ hashFiles('**/package-lock.json') }} | |
restore-keys: | | |
${{ github.job }}-npm- | |
- name: List the state of dependencies | |
if: steps.cache-npm.outputs.cache-hit != 'true' | |
continue-on-error: true | |
run: npm list | |
- name: Install dependencies | |
run: npm ci | |
- name: Rebuild the dist/ directory | |
run: | | |
npm run build | |
npm run package | |
- name: Compare the expected and actual dist/ directories | |
run: | | |
if [[ -n "$(git status --porcelain 2>/dev/null)" ]]; then | |
echo "DIFF=true" >> $GITHUB_OUTPUT | |
echo "Detected uncommitted changes after build. See status below:" | |
git diff --text --ignore-space-at-eol | |
fi | |
id: diff | |
- name: Import GPG signing information | |
if: steps.diff.outputs.DIFF == 'true' | |
uses: crazy-max/ghaction-import-gpg@v6 | |
with: | |
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }} | |
passphrase: ${{ secrets.GPG_PASSPHRASE }} | |
git_config_global: true | |
git_user_signingkey: true | |
git_commit_gpgsign: true | |
id: committer | |
- name: Create pull request if updated version is different | |
if: steps.diff.outputs.DIFF == 'true' | |
uses: peter-evans/create-pull-request@v7 | |
with: | |
token: ${{ secrets.ACCESS_TOKEN }} | |
commit-message: Update rebuilt distributable | |
author: John Paul E. Balandan, CPA <[email protected]> | |
committer: John Paul E. Balandan, CPA <[email protected]> | |
branch: update-build-dist | |
delete-branch: true | |
base: '2.x' | |
title: '[automated] update rebuilt distributable' | |
labels: type/enhancement |