actions/.github/workflows/ci-update-dist.yml
2024-11-14 12:35:29 -07:00

54 lines
1.6 KiB
YAML

name: CI-update-dist
on:
workflow_dispatch:
push:
branches:
- 'main'
- 'release/**'
paths-ignore:
- 'dist/**'
permissions:
contents: read
jobs:
update-dist:
# Only run for the Gradle repository; otherwise when users create pull requests from their `main` branch
# it would erroneously update `dist` on their branch (and the pull request)
if: github.repository == 'gradle/actions'
permissions:
contents: write
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
token: ${{ secrets.BOT_GITHUB_TOKEN }}
- name: Set up Node.js
uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.1.0
with:
node-version: 20
cache: npm
cache-dependency-path: sources/package-lock.json
- name: Build distribution
run: |
npm clean-install
npm run check
npm run compile
working-directory: sources
- name: Copy the generated sources/dist directory to the top-level dist
run: |
cp -r sources/dist .
# Commit and push changes; has no effect if the files did not change
# Important: The push event will not trigger any other workflows, see
# https://github.com/stefanzweifel/git-auto-commit-action?tab=readme-ov-file#commits-made-by-this-action-do-not-trigger-new-workflow-runs
- name: Commit & push changes
uses: stefanzweifel/git-auto-commit-action@8621497c8c39c72f3e2a999a26b4ca1b5058a842 # v5.0.1
with:
commit_message: '[bot] Update dist directory'
file_pattern: dist