diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index b198a81..2c87582 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -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: @@ -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 }}