From d301a93f1e222a4436e43f83398cbe673d942c80 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=96=E7=95=8C?= Date: Tue, 26 Mar 2024 19:16:26 +0800 Subject: [PATCH] Add fury release --- .github/workflows/linux.yml | 29 ++++++++++++++++++++ .goreleaser.fury.yaml | 53 +++++++++++++++++++++++++++++++++++++ .goreleaser.yaml | 9 ++++++- Makefile | 5 +++- 4 files changed, 94 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/linux.yml create mode 100644 .goreleaser.fury.yaml diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml new file mode 100644 index 0000000..9bc2502 --- /dev/null +++ b/.github/workflows/linux.yml @@ -0,0 +1,29 @@ +name: Release to Linux repository + +on: + release: + types: + - published + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4 + with: + fetch-depth: 0 + - name: Setup Go + uses: actions/setup-go@v5 + with: + go-version: ^1.22 + - name: Publish release + uses: goreleaser/goreleaser-action@v5 + with: + distribution: goreleaser-pro + version: latest + args: release -f .goreleaser.fury.yaml --clean + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GORELEASER_KEY: ${{ secrets.GORELEASER_KEY }} + FURY_TOKEN: ${{ secrets.FURY_TOKEN }} diff --git a/.goreleaser.fury.yaml b/.goreleaser.fury.yaml new file mode 100644 index 0000000..f0885fc --- /dev/null +++ b/.goreleaser.fury.yaml @@ -0,0 +1,53 @@ +project_name: serenity +builds: + - id: main + main: ./cmd/serenity + flags: + - -v + - -trimpath + ldflags: + - -X github.com/sagernet/serenity/constant.Version={{ .Version }} -s -w -buildid= + env: + - CGO_ENABLED=0 + targets: + - linux_386 + - linux_amd64_v1 + - linux_arm64 + - linux_arm_7 + - linux_s390x + - linux_riscv64 + mod_timestamp: '{{ .CommitTimestamp }}' +snapshot: + name_template: "{{ .Version }}.{{ .ShortCommit }}" +nfpms: + - &template + id: package + package_name: serenity + file_name_template: '{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}{{ with .Arm }}v{{ . }}{{ end }}{{ with .Mips }}_{{ . }}{{ end }}{{ if not (eq .Amd64 "v1") }}{{ .Amd64 }}{{ end }}' + builds: + - main + vendor: sagernet + homepage: https://serenity.sagernet.org/ + maintainer: nekohasekai + description: The configuration generator for sing-box. + license: GPLv3 or later + formats: + - deb + - rpm + priority: extra + contents: + - src: release/config/config.json + dst: /etc/serenity/config.json + type: config + - src: release/config/serenity.service + dst: /etc/systemd/system/serenity.service + - src: release/config/serenity@.service + dst: /etc/systemd/system/serenity@.service + - src: LICENSE + dst: /usr/share/licenses/serenity/LICENSE +release: + disable: true +furies: + - account: sagernet + ids: + - package diff --git a/.goreleaser.yaml b/.goreleaser.yaml index 0b7af17..e1b615f 100644 --- a/.goreleaser.yaml +++ b/.goreleaser.yaml @@ -15,6 +15,7 @@ builds: - linux_arm64 - linux_arm_7 - linux_s390x + - linux_riscv64 mod_timestamp: '{{ .CommitTimestamp }}' snapshot: name_template: "{{ .Version }}.{{ .ShortCommit }}" @@ -55,6 +56,12 @@ nfpms: dst: /etc/systemd/system/serenity@.service - src: LICENSE dst: /usr/share/licenses/serenity/LICENSE + deb: + signature: + key_file: "{{ .Env.NFPM_KEY_PATH }}" + rpm: + signature: + key_file: "{{ .Env.NFPM_KEY_PATH }}" source: enabled: false name_template: '{{ .ProjectName }}-{{ .Version }}.source' @@ -70,4 +77,4 @@ release: name: serenity name_template: '{{ if .IsSnapshot }}{{ nightly }}{{ else }}{{ .Version }}{{ end }}' draft: true - mode: replace \ No newline at end of file + mode: replace diff --git a/Makefile b/Makefile index be45fca..84b8995 100644 --- a/Makefile +++ b/Makefile @@ -36,12 +36,15 @@ lint_install: go install -v github.com/golangci/golangci-lint/cmd/golangci-lint@latest release: - goreleaser release --clean --skip-publish || exit 1 + goreleaser release --clean --skip publish mkdir dist/release mv dist/*.tar.gz dist/*.deb dist/*.rpm dist/*.pkg.tar.zst dist/release ghr --replace --draft --prerelease -p 3 "v${VERSION}" dist/release rm -r dist/release +release_repo: + goreleaser release -f .goreleaser.fury.yaml --clean + release_install: go install -v github.com/goreleaser/goreleaser@latest go install -v github.com/tcnksm/ghr@latest