Changeset Version Bump #3
Workflow file for this run
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
name: "Tag on Pull Request merge" | ||
on: | ||
# Should trigger only when a Pull Request is Closed | ||
# (the action will not create the Tag if the Pull Request is discarded - closed without merge) | ||
pull_request: | ||
types: | ||
- closed | ||
branches: | ||
- main | ||
- test_workflow_branch | ||
jobs: | ||
TagOnPR: | ||
name: Tag on Pull Request merge | ||
runs-on: ubuntu-latest | ||
# This 'if' condition is important for ensuring the workflow only runs for merged PRs | ||
# (avoid running when a PR is discarded - closed without merging) | ||
if: | | ||
Check failure on line 18 in .github/workflows/tag-release-on-pr-merged.yml GitHub Actions / Tag on Pull Request mergeInvalid workflow file
|
||
contains(github.event.pull_request.title, 'Version Bump') && | ||
github.event.pull_request.merged == true && | ||
steps.check_version.outputs.validVersion == 'true' | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v2 | ||
- name: Check Version | ||
id: check_version | ||
run: | | ||
version=$(echo "$GITHUB_EVENT_PULL_REQUEST_TITLE" | grep -o -E '[0-9]+\.[0-9]+\.[0-9]+') | ||
if [[ -n "$version" ]]; then | ||
echo "::set-output name=validVersion::true" | ||
echo "::set-output name=version::$version" | ||
else | ||
echo "::set-output name=validVersion::false" | ||
- name: Tag Version | ||
if: ${{ steps.check_version.outputs.validVersion == 'true' }} | ||
run: | | ||
git tag -a ${{ steps.check_version.outputs.version }} -m "Tagging version ${{ steps.check_version.outputs.version }}" | ||
git push origin ${{ steps.check_version.outputs.version }} | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
- name: Print fetched version | ||
run: echo "${{ steps.check_version.outputs.version }}" |