You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Open-IM-Server/.github/workflows/auto-tag.yml

39 lines
1.1 KiB

name: Create Tag
on:
issue_comment:
types: [created]
pull_request_review_comment:
types: [created]
jobs:
create_tag:
runs-on: ubuntu-latest
if: startsWith(github.event.comment.body, '/create tag')
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Validate version number and get comment
id: validate
run: |
COMMENT="${{ github.event.comment.body }}"
VERSION=$(echo $COMMENT | cut -d ' ' -f 3)
TAG_COMMENT=$(echo $COMMENT | cut -d '"' -f 2)
if [[ $VERSION =~ ^v([0-9]+\.){2}[0-9]+$ ]]; then
echo "version=$VERSION" >> $GITHUB_STATE
echo "tag_comment=$TAG_COMMENT" >> $GITHUB_STATE
else
echo "Invalid version number."
exit 1
fi
- name: Create a new tag
env:
GH_TOKEN: ${{ secrets.BOT_GITHUB_TOKEN }}
run: |
source $GITHUB_STATE
git tag -a $VERSION -m "$tag_comment"
git push origin $VERSION
echo "tag_created=$VERSION" >> $GITHUB_OUTPUT