Skip to content

Commit

Permalink
🚀 deployment: up to date file CI.CD #4
Browse files Browse the repository at this point in the history
  • Loading branch information
pnguyen215 committed Sep 21, 2023
1 parent e520a1b commit 60667d0
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ name: Go
on:
push:
branches: [ "master" ]
tags:
- "v*"
pull_request:
branches: [ "master" ]

Expand All @@ -26,3 +28,33 @@ jobs:

- name: Test
run: go test -v ./...

create-release:
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/v') # Only run this job when a valid tag is pushed
steps:
- name: Check if tag exists
id: check_tag
run: |
if [ -n "$GITHUB_REF" ]; then
TAG=${GITHUB_REF#refs/tags/}
# echo "::set-output name=tag::$TAG"
echo "TAG=${TAG}" >> $GITHUB_ENV
else
# echo "::set-output name=tag::"
echo "TAG=" >> $GITHUB_ENV
fi
shell: bash

- name: Create GitHub Release
id: create_release
uses: softprops/action-gh-release@v1
with:
# tag_name: ${{ steps.check_tag.outputs.tag }}
tag_name: ${{ env.TAG }}
body: |
:gem: released new version ${{ env.TAG }}
draft: false
prerelease: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 comments on commit 60667d0

Please sign in to comment.