Refactor CI workflow: Update Go version to 1.20 and enclose in quotes #16
Workflow file for this run
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
name: CI | |
on: | |
push: | |
branches: | |
- main | |
tags: | |
- "v*.*.*" # Triggers release on tags like v1.0.0 | |
pull_request: | |
workflow_dispatch: | |
permissions: | |
contents: write # Required for creating releases | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Set up Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version: "1.20" # Enclosed in quotes to prevent misinterpretation | |
- name: Run Tests | |
run: go test -v ./... | |
release: | |
needs: test | |
runs-on: ubuntu-latest | |
if: startsWith(github.ref, 'refs/tags/') | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Set up Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version: "1.20" # Enclosed in quotes | |
- name: Run GoReleaser | |
uses: goreleaser/goreleaser-action@v2 | |
with: | |
version: "v2.20.0" # Include the 'v' prefix | |
args: "release --clean" # Use '--clean' instead of '--rm-dist' | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Correctly pass the token |