-
Notifications
You must be signed in to change notification settings - Fork 9
39 lines (39 loc) · 1.56 KB
/
release.yaml
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
38
39
name: Release
on:
release:
types: [ released ]
jobs:
release:
name: Bump version & push tags
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Prepare new version number helper
run: |
export TAG_NAME=${{ github.event.release.tag_name }}
echo "NEW_VERSION=${TAG_NAME:1:${#TAG_NAME}}" >> $GITHUB_ENV
- name: Configure Git
run: |
git config user.email "[email protected]"
git config user.name $GITHUB_ACTOR
- name: Delete existing tag
run: git tag -d "v$NEW_VERSION"
- name: Bump the version
run: yarn version --new-version $NEW_VERSION --message "Bump version to %s"
- name: Push to master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: git push --force "https://$GITHUB_ACTOR:[email protected]/$GITHUB_REPOSITORY" "HEAD:master"
- name: Push the new tag
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: git push --force "https://$GITHUB_ACTOR:[email protected]/$GITHUB_REPOSITORY" "HEAD:$GITHUB_REF"
- name: Push the major & minor tag
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
git push --force "https://$GITHUB_ACTOR:[email protected]/$GITHUB_REPOSITORY" "HEAD:refs/tags/v${NEW_VERSION%.*}"
git push --force "https://$GITHUB_ACTOR:[email protected]/$GITHUB_REPOSITORY" "HEAD:refs/tags/v${NEW_VERSION%.*.*}"