Skip to content

Merge pull request #5 from zanussbaum/release-please--branches--test-… #14

Merge pull request #5 from zanussbaum/release-please--branches--test-…

Merge pull request #5 from zanussbaum/release-please--branches--test-… #14

Workflow file for this run

# .github/workflows/release-please.yml
name: Release Please
on:
push:
branches:
- main
- test-release
workflow_run:
workflows: ["Test"]
types:
- completed
permissions:
contents: write
pull-requests: write
id-token: write
jobs:
release-please:
if: |
github.event_name == 'push' ||
(github.event_name == 'workflow_run' && github.event.workflow_run.conclusion == 'success')
runs-on: ubuntu-latest
steps:
- name: Get branch name
id: branch-name
run: |
if [ "${{ github.event_name }}" = "push" ]; then
echo "branch=${{ github.ref_name }}" >> $GITHUB_OUTPUT
else
echo "branch=${{ github.event.workflow_run.head_branch }}" >> $GITHUB_OUTPUT
fi
- uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ steps.branch-name.outputs.branch }}
token: ${{ secrets.RELEASE_PLEASE_TOKEN }}
- uses: googleapis/release-please-action@v4
id: release
with:
release-type: node
target-branch: ${{ steps.branch-name.outputs.branch }}
config-file: .github/release-please-config.json
token: ${{ secrets.RELEASE_PLEASE_TOKEN }}
# Only proceed with npm steps if a release was created
- uses: actions/setup-node@v4
if: ${{ steps.release.outputs.release_created }}
with:
node-version: "20.x"
registry-url: "https://registry.npmjs.org"
# Generate package-lock.json first
- name: Generate package-lock.json
if: ${{ steps.release.outputs.release_created }}
run: npm install --package-lock-only
# Now npm ci should work
- name: Install dependencies
if: ${{ steps.release.outputs.release_created }}
run: npm ci
- name: Build
if: ${{ steps.release.outputs.release_created }}
run: npm run build
- name: NPM Publish Dry Run
if: ${{ steps.release.outputs.release_created }}
run: npm publish --dry-run
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
- name: NPM Publish
if: ${{ steps.release.outputs.release_created }}
run: npm publish
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}