From e478d3c2dc3eab29c1ed73e278c1ad9dca5ec827 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=96=E7=95=8C?= Date: Wed, 24 Jan 2024 12:13:12 +0800 Subject: [PATCH] Update workflow --- .github/workflows/debug.yml | 36 +++++++----------------------------- .github/workflows/docker.yml | 22 +++++++--------------- .github/workflows/lint.yml | 8 ++++---- 3 files changed, 18 insertions(+), 48 deletions(-) diff --git a/.github/workflows/debug.yml b/.github/workflows/debug.yml index 93b9cb08..09eac9d5 100644 --- a/.github/workflows/debug.yml +++ b/.github/workflows/debug.yml @@ -25,22 +25,10 @@ jobs: uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4 with: fetch-depth: 0 - - name: Get latest go version - id: 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/setup-go@v5 with: - go-version: ${{ steps.version.outputs.go_version }} - - name: Add cache to Go proxy - run: | - version=`git rev-parse HEAD` - mkdir build - pushd build - go mod init build - go get -v github.com/sagernet/sing-box@$version - popd + go-version: ^1.21 continue-on-error: true - name: Run Test run: | @@ -56,7 +44,7 @@ jobs: - name: Setup Go uses: actions/setup-go@v5 with: - go-version: 1.18.10 + go-version: ~1.18 - name: Cache go module uses: actions/cache@v3 with: @@ -76,13 +64,13 @@ jobs: - name: Setup Go uses: actions/setup-go@v5 with: - go-version: 1.20.7 + go-version: ^1.20 - name: Cache go module uses: actions/cache@v3 with: path: | ~/go/pkg/mod - key: go118-${{ hashFiles('**/go.sum') }} + key: go120-${{ hashFiles('**/go.sum') }} - name: Run Test run: make ci_build cross: @@ -188,8 +176,7 @@ jobs: - name: freebsd-arm64 goos: freebsd goarch: arm64 - - fail-fast: false + fail-fast: true runs-on: ubuntu-latest env: GOOS: ${{ matrix.goos }} @@ -204,19 +191,10 @@ jobs: uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4 with: fetch-depth: 0 - - name: Get latest go version - id: 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/setup-go@v5 with: - go-version: ${{ steps.version.outputs.go_version }} + go-version: ^1.21 - name: Build id: build - run: make - - name: Upload artifact - uses: actions/upload-artifact@v4 - with: - name: sing-box-${{ matrix.name }} - path: sing-box* + run: make \ No newline at end of file diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index a106e593..285af2ab 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -1,9 +1,10 @@ name: Build Docker Images + on: - workflow_dispatch: - inputs: - tag: - description: "The tag version you want to build" + release: + types: + - published + jobs: build: runs-on: ubuntu-latest @@ -25,15 +26,6 @@ jobs: uses: docker/metadata-action@v5 with: images: ghcr.io/sagernet/sing-box - - name: Get tag to build - id: tag - run: | - echo "latest=ghcr.io/sagernet/sing-box:latest" >> $GITHUB_OUTPUT - if [[ -z "${{ github.event.inputs.tag }}" ]]; then - echo "versioned=ghcr.io/sagernet/sing-box:${{ github.ref_name }}" >> $GITHUB_OUTPUT - else - echo "versioned=ghcr.io/sagernet/sing-box:${{ github.event.inputs.tag }}" >> $GITHUB_OUTPUT - fi - name: Build and release Docker images uses: docker/build-push-action@v5 with: @@ -42,6 +34,6 @@ jobs: build-args: | BUILDKIT_CONTEXT_KEEP_GIT_DIR=1 tags: | - ${{ steps.tag.outputs.latest }} - ${{ steps.tag.outputs.versioned }} + ghcr.io/sagernet/sing-box:latest + ghcr.io/sagernet/sing-box:${{ github.ref_name }} push: true diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 56d21b72..ab67a616 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -25,10 +25,10 @@ jobs: uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4 with: fetch-depth: 0 - - name: Get latest go version - id: 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/setup-go@v4 + with: + go-version: ^1.21 - name: Setup Go uses: actions/setup-go@v5 with: