Remove test-and-release workflow and add environment variable to go.yml
- .github/workflows/test-and-release.yml - Deleted the test-and-release GitHub Actions workflow entirely. - .github/workflows/go.yml - Added a new step to set `CGO_ENABLED=0` environment variable.
This commit is contained in:
3
.github/workflows/go.yml
vendored
3
.github/workflows/go.yml
vendored
@@ -21,6 +21,9 @@ jobs:
|
||||
with:
|
||||
go-version: '1.24'
|
||||
|
||||
- name: Set env
|
||||
run: echo "CGO_ENABLED=0 >> $GITHUB_ENV
|
||||
|
||||
- name: Build
|
||||
run: go build -v ./...
|
||||
|
||||
|
||||
60
.github/workflows/test-and-release.yml
vendored
60
.github/workflows/test-and-release.yml
vendored
@@ -1,60 +0,0 @@
|
||||
name: Test and Release
|
||||
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- 'v*.*.*' # Triggers on tags like v1.2.3
|
||||
pull_request:
|
||||
branches: [ main ]
|
||||
|
||||
jobs:
|
||||
test:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version: 1.24
|
||||
- name: Cache Go modules
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: |
|
||||
~/.cache/go-build
|
||||
~/go/pkg/mod
|
||||
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-go-
|
||||
- name: Install dependencies
|
||||
run: go mod download
|
||||
- name: Run tests
|
||||
run: go test -v ./...
|
||||
|
||||
release:
|
||||
if: startsWith(github.ref, 'refs/tags/v')
|
||||
runs-on: ubuntu-latest
|
||||
needs: test
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version: 1.24
|
||||
- name: Build binaries
|
||||
run: |
|
||||
mkdir -p dist
|
||||
GOOS=linux GOARCH=amd64 go build -o dist/app-linux-amd64
|
||||
GOOS=darwin GOARCH=amd64 go build -o dist/app-darwin-amd64
|
||||
GOOS=windows GOARCH=amd64 go build -o dist/app-windows-amd64.exe
|
||||
- name: Create Release
|
||||
uses: softprops/action-gh-release@v2
|
||||
with:
|
||||
tag_name: ${{ github.ref_name }}
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
- name: Upload Release Assets
|
||||
uses: softprops/action-gh-release@v2
|
||||
with:
|
||||
files: dist/*
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
Reference in New Issue
Block a user