Skip to content

✅ test: refactor test cases #2 #18

✅ test: refactor test cases #2

✅ test: refactor test cases #2 #18

Workflow file for this run

# 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
strategy:
matrix:
# Add Go versions as needed
go: ["1.21.x", "1.23.x"] # previous version "1.19", "1.20.x"
steps:
- uses: actions/checkout@v3
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: ${{ matrix.go }}
- name: Build
run: go build -v ./...
- name: Test
run: go test -v ./...
create-release:
runs-on: ubuntu-latest
# Only run this job when a valid tag is pushed
if: startsWith(github.ref, 'refs/tags/v')
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: Checkout repository
uses: actions/checkout@v3
with:
# Ensure all history is fetched
fetch-depth: 0
- name: Apply changelog
run: chmod +x git_changelog.sh
- name: Generate changelog
id: changelog
run: |
CHANGELOG=$(./git_changelog.sh)
echo "CHANGELOG=$CHANGELOG" >> $GITHUB_ENV
- name: Create GitHub Release
id: create_release
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ env.TAG }}
body: |
:gem: released new version ${{ env.TAG }}
Changelog:
${{ env.CHANGELOG }}
draft: false
prerelease: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}