-
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* ci: add tagger workflow * ci: use new output style for github actions
- Loading branch information
Showing
1 changed file
with
43 additions
and
0 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,43 @@ | ||
name: Tagger | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
tagger: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-node@v3 | ||
with: | ||
node-version: 18 | ||
|
||
- name: Check current version | ||
id: check_version | ||
run: echo "VERSION=$(node -p "require('./packages/core/package.json').version")" >> $GITHUB_OUTPUT | ||
|
||
- name: Check remote tags | ||
id: check_tags | ||
run: | | ||
git fetch --tags | ||
echo "TAGS=$(git tag -l)" >> $GITHUB_OUTPUT | ||
- name: Check if tag exists | ||
id: check_tag | ||
run: | | ||
if [[ "${{ steps.check_tags.outputs.TAGS }}" == *"${{ steps.check_version.outputs.VERSION }}"* ]]; then | ||
echo "TAG_EXISTS=true" >> $GITHUB_OUTPUT | ||
else | ||
echo "TAG_EXISTS=false" >> $GITHUB_OUTPUT | ||
fi | ||
- name: Push tag | ||
if: ${{ github.ref == 'refs/heads/master' && steps.check_tag.outputs.TAG_EXISTS == 'false' }} | ||
run: | | ||
git config --local user.email "github-actions[bot]@users.noreply.github.com" | ||
git config --local user.name "github-actions[bot]" | ||
git tag ${{ steps.check_version.outputs.VERSION }} | ||
git push origin ${{ steps.check_version.outputs.VERSION }} |