Skip to content

Commit ac0195e

Browse files
committed
🚀 deployment: updated file CI.CD #3
1 parent feba504 commit ac0195e

1 file changed

Lines changed: 32 additions & 0 deletions

File tree

.github/workflows/go.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ name: Go
66
on:
77
push:
88
branches: [ "master" ]
9+
tags:
10+
- "v*"
911
pull_request:
1012
branches: [ "master" ]
1113

@@ -26,3 +28,33 @@ jobs:
2628

2729
- name: Test
2830
run: go test -v ./...
31+
32+
create-release:
33+
runs-on: ubuntu-latest
34+
if: startsWith(github.ref, 'refs/tags/v') # Only run this job when a valid tag is pushed
35+
steps:
36+
- name: Check if tag exists
37+
id: check_tag
38+
run: |
39+
if [ -n "$GITHUB_REF" ]; then
40+
TAG=${GITHUB_REF#refs/tags/}
41+
# echo "::set-output name=tag::$TAG"
42+
echo "TAG=${TAG}" >> $GITHUB_ENV
43+
else
44+
# echo "::set-output name=tag::"
45+
echo "TAG=" >> $GITHUB_ENV
46+
fi
47+
shell: bash
48+
49+
- name: Create GitHub Release
50+
id: create_release
51+
uses: softprops/action-gh-release@v1
52+
with:
53+
# tag_name: ${{ steps.check_tag.outputs.tag }}
54+
tag_name: ${{ env.TAG }}
55+
body: |
56+
:gem: released new version ${{ env.TAG }}
57+
draft: false
58+
prerelease: false
59+
env:
60+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)