Skip to content

Commit

Permalink
Fix tag generation in release workflow (segmentio#2154)
Browse files Browse the repository at this point in the history
  • Loading branch information
varadarajan-tw authored Jul 9, 2024
1 parent 4ef29f2 commit 2f70282
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,11 @@ jobs:
fetch-depth: 0 # Shallow clones should be disabled to ensure the commit history for the repository is available to the action
fetch-tags: true

- uses: Setup git credentials
run: |
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
- name: Generate Release Tag
id: get-release-tag
run: ./scripts/generate-release-tags.sh
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/version-packages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ jobs:
- uses: actions/checkout@v4
with:
fetch-depth: 0
fetch-tags: true

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
Expand Down
6 changes: 4 additions & 2 deletions scripts/generate-release-tags.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ else

tag=$(printf release-$(date '+%Y-%m-%d%%s') $suffix)
echo "Tagging $sha with $tag"
git tag -a $tag -m "Release $tag"
git tag -a $tag -m "Release $tag" --force
git push origin $tag
fi

# this script assumes the last commit was publish commit and gets all package.json files changed in the last commit
Expand All @@ -47,5 +48,6 @@ files=$(git show --pretty="" --name-only HEAD | grep -Ei '^packages/.*package\.j
for file in $files; do
tag=$(cat $file | jq -r '.name + "@" + .version')
echo "Tagging $sha with $tag"
git tag -a $tag -m "Release $tag"
git tag -a $tag -m "Release $tag" --force
git push origin $tag
done

0 comments on commit 2f70282

Please sign in to comment.