Skip to content

chore(deps): bump actions/checkout from 5 to 7 (#23) #20

chore(deps): bump actions/checkout from 5 to 7 (#23)

chore(deps): bump actions/checkout from 5 to 7 (#23) #20

name: Release Please
on:
push:
branches:
- main
permissions:
contents: write
pull-requests: write
jobs:
release-please:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
with:
fetch-depth: 0
token: ${{ secrets.RELEASE_PLEASE_TOKEN }}
- uses: googleapis/release-please-action@45996ed1f6d02564a971a2fa1b5860e934307cf7 # v5.0.0
id: rp
with:
token: ${{ secrets.RELEASE_PLEASE_TOKEN }}
- name: Create GitHub Release
if: ${{ steps.rp.outputs.release_created == 'true' && steps.rp.outputs.tag_name != '' }}
env:
GH_TOKEN: ${{ secrets.RELEASE_PLEASE_TOKEN }}
TAG: ${{ steps.rp.outputs.tag_name }}
run: |
set -e
VERSION="${TAG#v}"
ESCAPED_VERSION=$(printf '%s' "${VERSION}" | sed 's/\./\\./g')
NOTES=''
if [ -f CHANGELOG.md ]; then
NOTES=$(awk "/^## \[${ESCAPED_VERSION}\]/{found=1; next} /^## \[/{if(found) exit} found{print}" CHANGELOG.md || true)
fi
INSTALL=$(printf '%s\n' \
'# Installation' \
'' \
'```bash' \
'# Homebrew (macOS)' \
'brew install --cask thedavidweng/tap/money' \
'' \
'# Go (cross-platform)' \
"go install github.com/thedavidweng/money/cmd/money@${TAG}" \
'```')
FULL_NOTES=$(printf '%s\n\n%s' "${NOTES:-Release $TAG}" "$INSTALL")
if gh release view "$TAG" &>/dev/null; then
gh release edit "$TAG" --notes "${FULL_NOTES}"
else
gh release create "$TAG" \
--title "$TAG" \
--notes "${FULL_NOTES}"
fi