Skip to content

Commit

Permalink
Update release tag (#58)
Browse files Browse the repository at this point in the history
  • Loading branch information
marandaneto authored Nov 6, 2023
1 parent 71a7692 commit e299cba
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 1 deletion.
5 changes: 4 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,12 @@ jobs:

- name: Commit & push
run: |
echo "Tag name from github.ref_name: ${{ github.event.release.target_commitish }}"
./scripts/commit-code.sh ${{ github.event.release.target_commitish }}
- name: Update tag
run: |
./scripts/update-tag.sh ${{ github.event.release.tag_name }} ${{ github.event.release.target_commitish }}
# Let's be sure that everything works before we release
- name: Dry release
run: make dryRelease
Expand Down
24 changes: 24 additions & 0 deletions scripts/update-tag.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/bin/bash
set -euo pipefail

CURRENT_TAG="$1"
TEMP_TAG="${CURRENT_TAG}-temp"
GITHUB_BRANCH="${2}"

echo "Going to push the tag changes."
git config --global user.name 'PostHog Github Bot'
git config --global user.email 'github-bot@posthog.com'
git fetch
git checkout ${GITHUB_BRANCH}
# Create a new temporary tag after pushing the changes from the previous tag (bump version)
git tag -a ${TEMP_TAG} -m "${TEMP_TAG}"
# Remove the current tag
git tag -d ${CURRENT_TAG}
# Remove the current tag in remote machine
git push --delete origin ${CURRENT_TAG}
# Create a new tag that points to the temporary tag
git tag ${CURRENT_TAG} ${TEMP_TAG}
# Remove temporary tag
git tag -d ${TEMP_TAG}
# Propapate new tag to remote machine
git push --tags

0 comments on commit e299cba

Please sign in to comment.