Skip to content

Commit

Permalink
Create go.yml
Browse files Browse the repository at this point in the history
Signed-off-by: wyr121 <[email protected]>
  • Loading branch information
wyr121 authored Jan 10, 2024
1 parent f91a90c commit 8dcbfcf
Showing 1 changed file with 52 additions and 0 deletions.
52 changes: 52 additions & 0 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Build Core

on:
workflow_dispatch:
push:
paths-ignore:
- '**.md'
- 'docs/**'

jobs:
build:
runs-on: ubuntu-latest
env:
TAGS: with_quic,with_wireguard,with_gvisor,with_utls,with_ech,with_clash_api,with_outbound_provider

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Get latest go version
id: go_version
run: |
echo go_version=$(curl -s https://raw.githubusercontent.com/actions/go-versions/main/versions-manifest.json | grep -oE '"version": "[0-9]{1}.[0-9]{1,}(.[0-9]{1,})?"' | head -1 | cut -d':' -f2 | sed 's/ //g; s/"//g') >> $GITHUB_OUTPUT
- name: Setup Go
uses: actions/[email protected]
with:
go-version: 1.21.5

- name: Setup NDK
uses: nttld/setup-ndk@v1
id: setup-ndk
with:
ndk-version: r26b
add-to-path: false
local-cache: false

- name: Build core
env:
ANDROID_NDK_HOME: ${{ steps.setup-ndk.outputs.ndk-path }}
run: |
CC=${ANDROID_NDK_HOME}/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android34-clang
VERSION=$(CGO_ENABLED=0 go run ./cmd/internal/read_tag)
CGO_ENABLED=1 CC=${CC} GOARCH=arm64 GOOS=android go build -v -trimpath -ldflags "-X 'github.com/sagernet/sing-box/constant.Version=${VERSION}' -s -w -buildid=" -tags ${TAGS} ./cmd/sing-box
CGO_ENABLED=0 GOARCH=amd64 GOOS=windows go build -v -trimpath -ldflags "-X 'github.com/sagernet/sing-box/constant.Version=${VERSION}' -H windowsgui -s -w -buildid=" -tags ${TAGS} ./cmd/sing-box
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: sing-box_core
path: sing-box*

0 comments on commit 8dcbfcf

Please sign in to comment.