♻️ refactor: updated codebase #14 #97
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This workflow will build a golang project | |
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-go | |
name: Go | |
on: | |
push: | |
branches: [ "master" ] | |
tags: | |
- "v*" | |
pull_request: | |
branches: [ "master" ] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Go | |
uses: actions/setup-go@v3 | |
with: | |
go-version: 1.19 | |
- name: Build | |
run: go build -v ./... | |
- 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 }} |