Skip to content

Commit

Permalink
ci: add README to extra-files, revert update-versions.sh change (#47)
Browse files Browse the repository at this point in the history
  • Loading branch information
cwaldren-ld authored Jan 8, 2024
1 parent 6bece94 commit 5c6b9be
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 10 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/release-please.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down
4 changes: 2 additions & 2 deletions launchdarkly-server-sdk-2.0.0-0.rockspec
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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 = {
Expand Down
4 changes: 2 additions & 2 deletions launchdarkly-server-sdk-redis-2.0.0-0.rockspec
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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 = {
Expand Down
3 changes: 2 additions & 1 deletion release-please-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
"versioning": "default",
"extra-files": [
"launchdarkly-server-sdk.c",
".github/actions/ci/action.yml"
".github/actions/ci/action.yml",
"README.md"
]
}
}
Expand Down
18 changes: 16 additions & 2 deletions scripts/update-versions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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.
#
Expand Down Expand Up @@ -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
Expand All @@ -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."
Expand Down

0 comments on commit 5c6b9be

Please sign in to comment.