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 release commit | |
on: | |
# Trigger the workflow on push only for the master branch | |
push: | |
branches: | |
- master | |
env: | |
NODE_ENV: 'development' | |
GITHUB_TOKEN: ${{ secrets.BRANCH_CREATOR_TOKEN }} | |
jobs: | |
tag: | |
runs-on: ubuntu-latest | |
# Only run on a release commit | |
if: "startsWith(github.event.head_commit.message, 'chore(release):')" | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
fetch-depth: '0' | |
token: ${{ secrets.BRANCH_CREATOR_TOKEN }} | |
- run: echo "RELEASE_VERSION=$(git log -1 --pretty=%s)" >> $GITHUB_ENV | |
# parse out non-tag text | |
- run: echo "RELEASE_VERSION=$( echo $RELEASE_VERSION | sed 's/chore(release)://' )" >> $GITHUB_ENV | |
# remove spaces, but add back in `v` to tag, which is needed for standard-version | |
- run: echo "RELEASE_VERSION=v$(echo $RELEASE_VERSION | tr -d '[:space:]')" >> $GITHUB_ENV | |
- run: echo $RELEASE_VERSION | |
- run: git tag $RELEASE_VERSION | |
- name: Setup git for push | |
run: | | |
git remote add github "$REPO" | |
git config --local user.email "[email protected]" | |
git config --local user.name "GitHub Action" | |
- name: Push tags to master | |
run: git push "https://dirvine:${{ secrets.MERGE_BUMP_BRANCH_TOKEN }}@github.com/$GITHUB_REPOSITORY" HEAD:master --tags |