From 239a64c7e6360ed7cd2ac55be2a845f4028f41e7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=96=E7=95=8C?= Date: Sat, 4 May 2024 13:50:48 +0800 Subject: [PATCH] Update workflow --- .github/workflows/docker.yml | 32 +++++++++++++++++++++++++++++--- .github/workflows/linux.yml | 12 +++++++++++- .goreleaser.fury.yaml | 8 ++++++++ .goreleaser.yaml | 2 ++ 4 files changed, 50 insertions(+), 4 deletions(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index bb91fd8..d2f1eba 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -4,13 +4,35 @@ on: release: types: - released - + workflow_dispatch: + inputs: + tag: + description: "The tag version you want to build" jobs: build: runs-on: ubuntu-latest steps: + - name: Get commit to build + id: ref + run: |- + if [[ -z "${{ github.event.inputs.tag }}" ]]; then + ref="${{ github.ref_name }}" + else + ref="${{ github.event.inputs.tag }}" + fi + echo "ref=$ref" + echo "ref=$ref" >> $GITHUB_OUTPUT + if [[ $ref == *"-"* ]]; then + latest=latest-beta + else + latest=latest + fi + echo "latest=$latest" + echo "latest=$latest" >> $GITHUB_OUTPUT - name: Checkout - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4 + uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4 + with: + ref: ${{ steps.ref.outputs.ref }} - name: Setup Docker Buildx uses: docker/setup-buildx-action@v3 - name: Setup QEMU for Docker Buildx @@ -30,10 +52,14 @@ jobs: uses: docker/build-push-action@v5 with: platforms: linux/386,linux/amd64,linux/arm64,linux/s390x + context: . target: dist build-args: | BUILDKIT_CONTEXT_KEEP_GIT_DIR=1 +# tags: | +# ghcr.io/sagernet/sing-box:${{ steps.ref.outputs.latest }} +# ghcr.io/sagernet/sing-box:${{ steps.ref.outputs.ref }} tags: | ghcr.io/sagernet/serenity:latest - ghcr.io/sagernet/serenity:${{ github.ref_name }} + ghcr.io/sagernet/serenity:${{ steps.ref.outputs.ref }} push: true diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index 9bc2502..f1b22d6 100644 --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux.yml @@ -10,13 +10,21 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4 + uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4 with: fetch-depth: 0 - name: Setup Go uses: actions/setup-go@v5 with: go-version: ^1.22 + - name: Extract signing key + run: |- + mkdir -p $HOME/.gnupg + cat > $HOME/.gnupg/sagernet.key <> "$GITHUB_ENV" + EOF + echo "HOME=$HOME" >> "$GITHUB_ENV" - name: Publish release uses: goreleaser/goreleaser-action@v5 with: @@ -27,3 +35,5 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GORELEASER_KEY: ${{ secrets.GORELEASER_KEY }} FURY_TOKEN: ${{ secrets.FURY_TOKEN }} + NFPM_KEY_PATH: ${{ env.HOME }}/.gnupg/sagernet.key + NFPM_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} diff --git a/.goreleaser.fury.yaml b/.goreleaser.fury.yaml index 89c5ee0..dcd60d2 100644 --- a/.goreleaser.fury.yaml +++ b/.goreleaser.fury.yaml @@ -45,6 +45,14 @@ nfpms: dst: /usr/lib/systemd/system/serenity@.service - src: LICENSE dst: /usr/share/licenses/serenity/LICENSE + deb: + signature: + key_file: "{{ .Env.NFPM_KEY_PATH }}" + fields: + Bugs: https://github.com/SagerNet/sing-box/issues + rpm: + signature: + key_file: "{{ .Env.NFPM_KEY_PATH }}" release: disable: true furies: diff --git a/.goreleaser.yaml b/.goreleaser.yaml index b841fbd..0a0cabb 100644 --- a/.goreleaser.yaml +++ b/.goreleaser.yaml @@ -59,6 +59,8 @@ nfpms: deb: signature: key_file: "{{ .Env.NFPM_KEY_PATH }}" + fields: + Bugs: https://github.com/SagerNet/serenity/issues rpm: signature: key_file: "{{ .Env.NFPM_KEY_PATH }}"