-
Notifications
You must be signed in to change notification settings - Fork 0
51 lines (45 loc) · 1.61 KB
/
release_golang.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
40
41
42
43
44
45
46
47
48
49
50
name: Create/update tag
on:
push:
tags:
- "v*.*.*"
jobs:
create-tag:
strategy:
matrix:
api_module: [ common,ledger,lostid,notification,ocr,partition,payment,profile,property,settings,files ]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Get latest tags
id: get_tags
run: |
# Get the two most recent tags
TAGS=$(git tag --sort=-creatordate | grep '^go/${{ matrix.api_module }}/v' | head -n 1)
echo $TAGS
TAG_ARRAY=($TAGS)
if [ ${#TAG_ARRAY[@]} -lt 1 ]; then
echo "Not enough tags found"
echo "not_enough_tags=true" >> $GITHUB_OUTPUT
exit 0
fi
echo "latest_tag=${TAG_ARRAY[0]}" >> $GITHUB_ENV
echo "not_enough_tags=false" >> $GITHUB_OUTPUT
- name: Set output if changes found
if: steps.get_tags.outputs.not_enough_tags == 'false'
id: go_module_changed
run: |
if [[ $(git diff --name-only ${{ env.latest_tag }} HEAD | grep 'go/${{ matrix.api_module }}') ]]; then
echo "changed=true" >> $GITHUB_OUTPUT
else
echo "changed=false" >> $GITHUB_OUTPUT
fi
- uses: rickstaa/action-create-tag@v1
if: steps.get_tags.outputs.not_enough_tags == 'true' || steps.go_module_changed.outputs.changed == 'true'
id: "tag_create"
with:
tag: go/${{ matrix.api_module }}/${{github.ref_name}}
tag_exists_error: false
message: "release module go/${{ matrix.api_module }}/${{github.ref_name}}"