Skip to content

Commit

Permalink
chore: update release job
Browse files Browse the repository at this point in the history
compare `VERSION_NAME` and tag before publishing
  • Loading branch information
ttypic committed Dec 11, 2024
1 parent 5f712a9 commit 2c0f111
Showing 1 changed file with 23 additions and 1 deletion.
24 changes: 23 additions & 1 deletion .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,33 @@ on:
jobs:
run-on-release:
runs-on: ubuntu-latest

if: github.repository == 'ably/ably-java'
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Extract tag
id: tag
run: |
TAG=${GITHUB_REF#refs/tags/v}
echo "tag=$TAG" >> $GITHUB_OUTPUT
- name: Read VERSION_NAME from gradle.properties
id: version
run: |
VERSION_NAME=$(grep '^VERSION_NAME' gradle.properties | cut -d'=' -f2 | tr -d '[:space:]')
echo "version=$VERSION_NAME" >> $GITHUB_OUTPUT
- name: Compare version with tag
run: |
if [ "$VERSION" != "$TAG" ]; then
echo "VERSION ($VERSION) does not match tag ($TAG)."
exit 1
fi
env:
VERSION: ${{ steps.version.outputs.version }}
TAG: ${{ steps.tag.outputs.tag }}

- name: Set up JDK
uses: actions/setup-java@v4
with:
Expand Down

0 comments on commit 2c0f111

Please sign in to comment.