# Copyright © 2023 OpenIM. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. name: OpenIM 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@v4 - 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