73 lines
2.2 KiB
YAML
73 lines
2.2 KiB
YAML
name: release-please
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- base
|
|
|
|
permissions:
|
|
contents: write
|
|
pull-requests: write
|
|
id-token: write
|
|
|
|
jobs:
|
|
release-please:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: google-github-actions/release-please-action@v4
|
|
id: release
|
|
with:
|
|
token: ${{ secrets.CI_TOKEN }}
|
|
target-branch: base
|
|
config-file: release-please-config.json
|
|
manifest-file: .release-please-manifest.json
|
|
|
|
# Handle the PR artifacts while the PR is open/updated
|
|
# The output 'pr' is only present if a release PR was created or updated.
|
|
- name: Checkout PR branch
|
|
if: ${{ steps.release.outputs.pr }}
|
|
uses: actions/checkout@v4
|
|
with:
|
|
# Use headBranchName from the PR object
|
|
ref: ${{ fromJson(steps.release.outputs.pr).headBranchName }}
|
|
token: ${{ secrets.CI_TOKEN }}
|
|
|
|
- name: Setup Node
|
|
if: ${{ steps.release.outputs.pr }}
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: 20
|
|
cache: 'npm'
|
|
|
|
- name: Cache node_modules
|
|
if: ${{ steps.release.outputs.pr }}
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: node_modules
|
|
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
|
|
restore-keys: |
|
|
${{ runner.os }}-node-
|
|
|
|
- name: Install dependencies
|
|
if: ${{ steps.release.outputs.pr }}
|
|
run: npm ci
|
|
|
|
- name: Get version from package.json
|
|
if: ${{ steps.release.outputs.pr }}
|
|
id: package_version
|
|
run: |
|
|
VERSION=$(node -p "require('./package.json').version")
|
|
echo "version=$VERSION" >> $GITHUB_OUTPUT
|
|
|
|
- name: Generate production artifacts
|
|
if: ${{ steps.release.outputs.pr }}
|
|
run: npm run build
|
|
|
|
- name: Commit and push changes
|
|
if: ${{ steps.release.outputs.pr }}
|
|
uses: stefanzweifel/git-auto-commit-action@v5
|
|
with:
|
|
commit_message: "build: update production artifacts for v${{ steps.package_version.outputs.version }}"
|
|
file_pattern: "resources/dist/*"
|
|
branch: ${{ fromJson(steps.release.outputs.pr).headBranchName }}
|