-
Notifications
You must be signed in to change notification settings - Fork 0
67 lines (58 loc) · 2.09 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
59
60
61
62
63
64
65
66
67
name: Release Containers resolver Go module new version
on:
pull_request:
types:
- closed
branches:
- main
jobs:
tag-and-release:
if: github.event.pull_request.merged == true
runs-on: ubuntu-latest
steps:
- name: Checkout the repository
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- name: Git auth config
run: |
git config --local user.email "[email protected]"
git config --local user.name "${{ secrets.GH_USERNAME}}"
- name: Get and Format the PR Title
id: get_pr_title
run: |
pr_title="${{ github.event.pull_request.title }}"
# Use grep with regex to extract the format (AST-000) from the title
formatted_title=$(echo "$pr_title" | grep -oE "\(AST-[0-9]+\)")
# If formatted_title is empty, set a default value or handle the error
if [ -z "$formatted_title" ]; then
echo "No valid format found in PR title."
exit 1
fi
echo "formatted_title=$formatted_title" >> $GITHUB_ENV
- name: Fetch All Tags
run: git fetch --tags
- name: Get Latest Tag
id: get_tag
run: |
latest_tag=$(git describe --tags `git rev-list --tags --max-count=1`)
echo "tag=${latest_tag}" >> $GITHUB_ENV
- name: Bump Patch Version
id: bump
uses: cbrgm/semver-bump-action@main
with:
current-version: ${{ env.tag }}
bump-level: patch
- name: Create a new tag
run: |
new_tag=${{ steps.bump.outputs.new_version }}
git tag $new_tag -m "${{ env.formatted_title }}"
git push origin $new_tag
- name: Create release from tag
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ steps.bump.outputs.new_version }}
release_name: Release ${{ steps.bump.outputs.new_version }}
body: ${{ steps.get_pr_title.outputs.pr_title }}
draft: false
prerelease: false