Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| b14072ddb2 |
@@ -2,15 +2,16 @@ name: Build and Release Core
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ main ] # Runs tests on standard pushes
|
||||
tags:
|
||||
- 'v*' # Only trigger when you push a version tag (e.g., v1.0.0)
|
||||
- 'v*' # Runs tests AND builds/releases on tags
|
||||
pull_request:
|
||||
branches: [ main ] # Run tests on PRs, but don't build release binaries
|
||||
branches: [ main ]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: Test and Build
|
||||
runs-on: ubuntu-latest # This runs on your Gitea act_runner
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout Code
|
||||
uses: actions/checkout@v4
|
||||
@@ -18,20 +19,17 @@ jobs:
|
||||
- name: Setup Go
|
||||
uses: actions/setup-go@v4
|
||||
with:
|
||||
go-version: '1.26' # Update to match your go.mod if different
|
||||
go-version: '1.24' # Note: Adjusted to a currently valid Go version
|
||||
|
||||
- name: Run Tests
|
||||
run: go test ./... -v
|
||||
|
||||
- name: Build Binaries
|
||||
# Only run the build steps if this was triggered by a tag push
|
||||
if: startsWith(github.ref, 'refs/tags/')
|
||||
run: |
|
||||
|
||||
VERSION=${GITHUB_REF_NAME}
|
||||
COMMIT=$(echo ${GITHUB_SHA} | cut -c1-7)
|
||||
|
||||
|
||||
LDFLAGS="-X 'main.BuildVersion=$VERSION' -X 'main.BuildCommit=$COMMIT'"
|
||||
|
||||
mkdir -p bin
|
||||
@@ -45,9 +43,12 @@ jobs:
|
||||
echo "Building Windows (amd64)..."
|
||||
GOOS=windows GOARCH=amd64 go build -ldflags="$LDFLAGS" -o bin/rr-windows-amd64.exe ./cmd/rr/main.go
|
||||
|
||||
- name: Upload Artifacts
|
||||
- name: Create Release and Upload Binaries
|
||||
if: startsWith(github.ref, 'refs/tags/')
|
||||
uses: actions/upload-artifact@v4
|
||||
uses: softprops/action-gh-release@v1
|
||||
with:
|
||||
name: riskrancher-core-binaries
|
||||
path: bin/
|
||||
files: bin/*
|
||||
name: Release ${{ github.ref_name }}
|
||||
generate_release_notes: true
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITEA_TOKEN }}
|
||||
Reference in New Issue
Block a user