-
Notifications
You must be signed in to change notification settings - Fork 18
37 lines (33 loc) · 1.33 KB
/
tag_release.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
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 ::set-env name=RELEASE_VERSION::$(git log -1 --pretty=%B)
# parse out non-tag text
- run: echo ::set-env name=RELEASE_VERSION::$( echo $RELEASE_VERSION | sed 's/chore(release)://' )
# remove spaces, but add back in `v` to tag, which is needed for standard-version
- run: echo ::set-env name=RELEASE_VERSION::v$(echo $RELEASE_VERSION | tr -d '[:space:]')
- 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 "action@github.com"
git config --local user.name "GitHub Action"
- name: Push tags to master
run: git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$GITHUB_REPOSITORY" HEAD:master --tags