-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
50 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
name: Auto tag | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
tag: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout repository | ||
with: | ||
token: ${{ secrets.PAT }} | ||
uses: actions/checkout@v4 | ||
|
||
- name: Get last changelog version | ||
id: changelog_reader | ||
uses: mindsers/changelog-reader-action@v2 | ||
with: | ||
path: ./CHANGELOG.md | ||
|
||
- name: Check if tag exists | ||
id: check_tag | ||
run: | | ||
version=${{ steps.changelog_reader.outputs.version }} | ||
if git rev-parse "$version" >/dev/null 2>&1; then | ||
echo "Tag already exists" | ||
echo "::set-output name=tag_exists::true" | ||
else | ||
echo "Tag does not exist" | ||
echo "::set-output name=tag_exists::false" | ||
fi | ||
- name: Import GPG key | ||
if: steps.check_tag.outputs.tag_exists == 'false' | ||
env: | ||
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }} | ||
run: | | ||
echo "$GPG_PRIVATE_KEY" | gpg --batch --import | ||
- name: Create new tag | ||
if: steps.check_tag.outputs.tag_exists == 'false' | ||
run: | | ||
version=${{ steps.changelog_reader.outputs.version }} | ||
git config --global user.name "${{ github.actor }}" | ||
git config --global user.email "${{ github.actor }}@users.noreply.github.com" | ||
git tag -s "$version" -m "$version" --local-user $(gpg --list-keys --with-colons | grep '^pub' | cut -d':' -f5) | ||
git push origin "$version" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters