Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 32 additions & 8 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,28 @@ jobs:
token: ${{ steps.app-token.outputs.token }}
fetch-depth: 0

- name: Inject Manual Inputs into Config
shell: bash
run: |
# Determine if this is a prerelease
IS_PRERELEASE=${{ github.event.inputs.release-type == 'next' }}
PREID="${{ github.event.inputs.preid }}"

# Use jq to update the configuration file dynamically.
# We update the root package (.) with the workflow inputs.
jq --arg pre "$IS_PRERELEASE" --arg id "$PREID" \
'.packages["."].prerelease = ($pre == "true") | .packages["."]["prerelease-type"] = $id' \
release-please-config.json > tmp.json && mv tmp.json release-please-config.json

echo "Updated release-please-config.json:"
cat release-please-config.json

- name: Release Please
id: release
uses: googleapis/release-please-action@v4
with:
token: ${{ steps.app-token.outputs.token }}
skip-github-pull-request: true
prerelease: ${{ github.event.inputs.release-type == 'next' }}
prerelease-type: ${{ github.event.inputs.preid }}

# STAGE 2: Build & Publish
publish:
Expand All @@ -68,9 +82,19 @@ jobs:
- name: Publish to NPM
run: pnpm publish --no-git-checks --provenance --access public

- name: GitHub Release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ needs.bump.outputs.tag_name }}
body: ${{ needs.bump.outputs.body }}
prerelease: ${{ github.event.inputs.release-type == 'next' }}
- name: Create GitHub Release
shell: bash
run: |
echo "${{ needs.bump.outputs.body }}" > release_notes.md

PRERELEASE_FLAG=""
if [ "${{ github.event.inputs.release-type }}" = "next" ]; then
PRERELEASE_FLAG="--prerelease"
fi

gh release create ${{ needs.bump.outputs.tag_name }} \
--title "${{ needs.bump.outputs.tag_name }}" \
--notes-file release_notes.md \
$PRERELEASE_FLAG
env:
GH_TOKEN: ${{ github.token }}