Add fury release

This commit is contained in:
世界 2024-03-26 19:16:26 +08:00
parent 7fbd117cec
commit d301a93f1e
No known key found for this signature in database
GPG Key ID: CD109927C34A63C4
4 changed files with 94 additions and 2 deletions

29
.github/workflows/linux.yml vendored Normal file
View File

@ -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 }}

53
.goreleaser.fury.yaml Normal file
View File

@ -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 <contact-git@sekai.icu>
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

View File

@ -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
mode: replace

View File

@ -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