diff --git a/.github/workflows/release-please.yml b/.github/workflows/release-please.yml index 251ff4d..caa7aa4 100644 --- a/.github/workflows/release-please.yml +++ b/.github/workflows/release-please.yml @@ -21,18 +21,18 @@ jobs: token: ${{ secrets.GITHUB_TOKEN }} - uses: actions/checkout@v4 - if: ${{ steps.release.outputs.releases_created }} + if: ${{ steps.release.outputs.prs_created }} - name: Update launchdarkly-server-sdk rockspec uses: ./.github/actions/update-versions - if: ${{ steps.release-metadata.outcome == 'success' }} + if: ${{ steps.release.outputs.prs_created }} with: package: launchdarkly-server-sdk branch: ${{ fromJSON(steps.release.outputs.pr).headBranchName }} - name: Update launchdarkly-server-sdk-redis rockspec uses: ./.github/actions/update-versions - if: ${{ steps.release-metadata.outcome == 'success' }} + if: ${{ steps.release.outputs.prs_created }} with: package: launchdarkly-server-sdk-redis branch: ${{ fromJSON(steps.release.outputs.pr).headBranchName }} diff --git a/launchdarkly-server-sdk-2.0.0-0.rockspec b/launchdarkly-server-sdk-2.0.0-0.rockspec index c39a7f6..17a8264 100644 --- a/launchdarkly-server-sdk-2.0.0-0.rockspec +++ b/launchdarkly-server-sdk-2.0.0-0.rockspec @@ -2,7 +2,7 @@ package = "launchdarkly-server-sdk" rockspec_format = "3.0" -version = "2.0.0-0" -- {x-release-please-version} +version = "2.0.0-0" description = { summary = "LaunchDarkly Lua Server-Side SDK", @@ -20,7 +20,7 @@ description = { source = { url = "git+https://github.com/launchdarkly/lua-server-sdk.git", - tag = "v2.0.0" -- {x-release-please-version} + tag = "v2.0.0" } dependencies = { diff --git a/launchdarkly-server-sdk-redis-2.0.0-0.rockspec b/launchdarkly-server-sdk-redis-2.0.0-0.rockspec index ff42e73..95e2dd0 100644 --- a/launchdarkly-server-sdk-redis-2.0.0-0.rockspec +++ b/launchdarkly-server-sdk-redis-2.0.0-0.rockspec @@ -2,7 +2,7 @@ package = "launchdarkly-server-sdk-redis" rockspec_format = "3.0" -version = "2.0.0-0" -- {x-release-please-version} +version = "2.0.0-0" description = { summary = "LaunchDarkly Lua Server-Side SDK Redis Source", @@ -19,7 +19,7 @@ description = { source = { url = "git+https://github.com/launchdarkly/lua-server-sdk.git", - tag = "v2.0.0" -- {x-release-please-version} + tag = "v2.0.0" } dependencies = { diff --git a/release-please-config.json b/release-please-config.json index a7efb60..306a8b1 100644 --- a/release-please-config.json +++ b/release-please-config.json @@ -6,7 +6,8 @@ "versioning": "default", "extra-files": [ "launchdarkly-server-sdk.c", - ".github/actions/ci/action.yml" + ".github/actions/ci/action.yml", + "README.md" ] } } diff --git a/scripts/update-versions.sh b/scripts/update-versions.sh index e296ea0..380824a 100755 --- a/scripts/update-versions.sh +++ b/scripts/update-versions.sh @@ -2,7 +2,11 @@ set -e -# This script renames a rockspec file containing one semantic version to another. +# This script has two responsibilities: +# 1. Update the package version in the rockspec file. This is necessary because release-please can't update +# a file that changes names. +# 2. Update the actual filename of the rockspec file. + # This script doesn't update the rockspec version - the part after the package version, but before the .rockspec # suffix. That should be done manually if the rockspec itself has changed but not the package contents. # @@ -68,6 +72,16 @@ for file in "$input_rockspec"-*.rockspec; do new_file_name="$input_rockspec-$input_version-$rockspec_revision.rockspec" git mv "$file" "$new_file_name" echo "Renamed $file to $new_file_name" + + # Update the 'version' field with the new semver. + sed -i.bak "s/version = \".*\"/version = \"$input_version-$rockspec_revision\"/" "$new_file_name" + echo "Bumped version from $semver to $input_version" + + # Update the 'tag' field to contain the git tag, which we're hardcoding as 'v' + the version number. This + # relies on the assumption that our release please config specifies a leading v. + sed -i.bak "s/tag = \".*\"/tag = \"v$input_version\"/" "$new_file_name" + echo "Updated source.tag to v$input_version" + rm -f "$new_file_name.bak" if [ "$(git status --porcelain | wc -l)" -gt 0 ]; then @@ -80,7 +94,7 @@ for file in "$input_rockspec"-*.rockspec; do git add "$new_file_name" git add README.md if [ $autocommit ]; then - git commit -m "chore: rename $input_rockspec version from $semver to $input_version" + git commit -m "chore: bump $input_rockspec version from $semver to $input_version" git push else echo "Changes staged, but not committed. Please commit manually."