Update workflow

This commit is contained in:
世界 2024-05-04 13:50:48 +08:00
parent e332417c3f
commit 239a64c7e6
No known key found for this signature in database
GPG Key ID: CD109927C34A63C4
4 changed files with 50 additions and 4 deletions

View File

@ -4,13 +4,35 @@ on:
release: release:
types: types:
- released - released
workflow_dispatch:
inputs:
tag:
description: "The tag version you want to build"
jobs: jobs:
build: build:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: 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 - name: Checkout
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4 uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4
with:
ref: ${{ steps.ref.outputs.ref }}
- name: Setup Docker Buildx - name: Setup Docker Buildx
uses: docker/setup-buildx-action@v3 uses: docker/setup-buildx-action@v3
- name: Setup QEMU for Docker Buildx - name: Setup QEMU for Docker Buildx
@ -30,10 +52,14 @@ jobs:
uses: docker/build-push-action@v5 uses: docker/build-push-action@v5
with: with:
platforms: linux/386,linux/amd64,linux/arm64,linux/s390x platforms: linux/386,linux/amd64,linux/arm64,linux/s390x
context: .
target: dist target: dist
build-args: | build-args: |
BUILDKIT_CONTEXT_KEEP_GIT_DIR=1 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: | tags: |
ghcr.io/sagernet/serenity:latest ghcr.io/sagernet/serenity:latest
ghcr.io/sagernet/serenity:${{ github.ref_name }} ghcr.io/sagernet/serenity:${{ steps.ref.outputs.ref }}
push: true push: true

View File

@ -10,13 +10,21 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4 uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4
with: with:
fetch-depth: 0 fetch-depth: 0
- name: Setup Go - name: Setup Go
uses: actions/setup-go@v5 uses: actions/setup-go@v5
with: with:
go-version: ^1.22 go-version: ^1.22
- name: Extract signing key
run: |-
mkdir -p $HOME/.gnupg
cat > $HOME/.gnupg/sagernet.key <<EOF
${{ secrets.GPG_KEY }}
echo "HOME=$HOME" >> "$GITHUB_ENV"
EOF
echo "HOME=$HOME" >> "$GITHUB_ENV"
- name: Publish release - name: Publish release
uses: goreleaser/goreleaser-action@v5 uses: goreleaser/goreleaser-action@v5
with: with:
@ -27,3 +35,5 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GORELEASER_KEY: ${{ secrets.GORELEASER_KEY }} GORELEASER_KEY: ${{ secrets.GORELEASER_KEY }}
FURY_TOKEN: ${{ secrets.FURY_TOKEN }} FURY_TOKEN: ${{ secrets.FURY_TOKEN }}
NFPM_KEY_PATH: ${{ env.HOME }}/.gnupg/sagernet.key
NFPM_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}

View File

@ -45,6 +45,14 @@ nfpms:
dst: /usr/lib/systemd/system/serenity@.service dst: /usr/lib/systemd/system/serenity@.service
- src: LICENSE - src: LICENSE
dst: /usr/share/licenses/serenity/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: release:
disable: true disable: true
furies: furies:

View File

@ -59,6 +59,8 @@ nfpms:
deb: deb:
signature: signature:
key_file: "{{ .Env.NFPM_KEY_PATH }}" key_file: "{{ .Env.NFPM_KEY_PATH }}"
fields:
Bugs: https://github.com/SagerNet/serenity/issues
rpm: rpm:
signature: signature:
key_file: "{{ .Env.NFPM_KEY_PATH }}" key_file: "{{ .Env.NFPM_KEY_PATH }}"