Skip to content

Merge pull request #1 from rainbend/codex/release-actions #1

Merge pull request #1 from rainbend/codex/release-actions

Merge pull request #1 from rainbend/codex/release-actions #1

Workflow file for this run

name: Release
on:
push:
tags:
- "*"
permissions:
contents: write
jobs:
test:
name: Test
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod
- name: Test
run: go test ./...
build:
name: Build release binaries
needs: test
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- goos: linux
goarch: amd64
os_name: linux
ext: ""
- goos: linux
goarch: arm64
os_name: linux
ext: ""
- goos: darwin
goarch: amd64
os_name: macos
ext: ""
- goos: darwin
goarch: arm64
os_name: macos
ext: ""
- goos: windows
goarch: amd64
os_name: windows
ext: ".exe"
- goos: windows
goarch: arm64
os_name: windows
ext: ".exe"
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod
- name: Build
env:
GOOS: ${{ matrix.goos }}
GOARCH: ${{ matrix.goarch }}
CGO_ENABLED: "0"
VERSION: ${{ github.ref_name }}
run: |
mkdir -p dist
output="dist/sing-box-sub_${VERSION}_${{ matrix.os_name }}_${GOARCH}${{ matrix.ext }}"
go build \
-trimpath \
-ldflags "-s -w -X main.version=${VERSION}" \
-o "${output}" \
./cmd/sing-box-subscribe-cli
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: sing-box-sub_${{ github.ref_name }}_${{ matrix.os_name }}_${{ matrix.goarch }}
path: dist/*
if-no-files-found: error
release:
name: Publish GitHub release
needs: build
runs-on: ubuntu-latest
steps:
- name: Download artifacts
uses: actions/download-artifact@v4
with:
path: dist
merge-multiple: true
- name: Upload release assets
uses: softprops/action-gh-release@v2
with:
files: dist/*