forked from taikoxyz/trailblazer-adapters
-
Notifications
You must be signed in to change notification settings - Fork 1
58 lines (50 loc) · 1.61 KB
/
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
name: Release on Push to Main
on:
push:
branches:
- main
jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: 'go.mod'
- name: Install dependencies
run: go mod tidy
- name: Get the current tag
id: get_tag
run: |
TAG=$(git describe --tags `git rev-list --tags --max-count=1`)
echo "Current tag: $TAG"
echo "tag=$TAG" >> "$GITHUB_OUTPUT"
- name: Bump version and create tag
id: bump_version
run: |
git config --global user.name 'github-actions[bot]'
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
# Get the current tag
TAG=${{ steps.get_tag.outputs.tag }}
# Extract the version number components
IFS='.' read -r -a VERSION_PARTS <<< "${TAG#v}"
MAJOR=${VERSION_PARTS[0]}
MINOR=${VERSION_PARTS[1]}
PATCH=${VERSION_PARTS[2]}
# Increment the patch version number
NEW_TAG="v$MAJOR.$MINOR.$((PATCH + 1))"
# Create a new tag
git tag $NEW_TAG
git push origin $NEW_TAG
echo "New tag: $NEW_TAG"
echo "new_tag=$NEW_TAG" >> "$GITHUB_OUTPUT"
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ steps.bump_version.outputs.new_tag }}
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}