From a0d483401658c80d471f1f163026618b74801966 Mon Sep 17 00:00:00 2001 From: Matt Spurrier Date: Sat, 30 Mar 2024 18:10:49 +0800 Subject: [PATCH] add workflows --- .github/workflows/release.yaml | 40 +++++++++++++++++++++ .goreleaser.yaml | 64 ++++++++++++++++++++++++++++++++++ cmd/.goreleaser.yaml | 29 --------------- 3 files changed, 104 insertions(+), 29 deletions(-) create mode 100644 .github/workflows/release.yaml create mode 100644 .goreleaser.yaml delete mode 100644 cmd/.goreleaser.yaml diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml new file mode 100644 index 0000000..7eda933 --- /dev/null +++ b/.github/workflows/release.yaml @@ -0,0 +1,40 @@ +name: goreleaser + +on: + pull_request: + push: + # run only against tags + tags: + - "*" + +permissions: + contents: write + # packages: write + # issues: write + +jobs: + goreleaser: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + - name: Set up Go + uses: actions/setup-go@v5 + with: + go-version: stable + # More assembly might be required: Docker logins, GPG, etc. + # It all depends on your needs. + - name: Run GoReleaser + uses: goreleaser/goreleaser-action@v5 + with: + # either 'goreleaser' (default) or 'goreleaser-pro' + distribution: goreleaser + # 'latest', 'nightly', or a semver + version: latest + args: release --clean + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + # Your GoReleaser Pro key, if you are using the 'goreleaser-pro' distribution + # GORELEASER_KEY: ${{ secrets.GORELEASER_KEY }} \ No newline at end of file diff --git a/.goreleaser.yaml b/.goreleaser.yaml new file mode 100644 index 0000000..81a219c --- /dev/null +++ b/.goreleaser.yaml @@ -0,0 +1,64 @@ +# yaml-language-server: $schema=https://goreleaser.com/static/schema.json +# vim: set ts=2 sw=2 tw=0 fo=cnqoj + +version: 1 + +before: + hooks: + - go mod tidy + +builds: + - + id: "quickpassthrough" + main: ./cmd/main.go + binary: "quickpassthrough" + env: + - CGO_ENABLED=0 + goos: + - linux + - windows + + goarch: + - amd64 + - arm + - arm64 + goarm: + - 6 + - 7 + + # GOAMD64 to build when GOARCH is amd64. + # For more info refer to: https://golang.org/doc/install/source#environment + # + # Default: [ 'v1' ] + goamd64: + - v1 + - v2 + - v3 + - v4 + + mod_timestamp: "{{ .CommitTimestamp }}" + +archives: + - format: tar.gz + # this name template makes the OS and Arch compatible with the results of `uname`. + name_template: >- + {{ .ProjectName }}_ + {{- title .Os }}_ + {{- if eq .Arch "amd64" }}x86_64 + {{- else if eq .Arch "386" }}i386 + {{- else }}{{ .Arch }}{{ end }} + {{- if .Arm }}v{{ .Arm }}{{ end }} + +changelog: + sort: asc + filters: + exclude: + - "^docs:" + - "^test:" + +upx: + - + enabled: true + compress: best + lzma: true + brute: true \ No newline at end of file diff --git a/cmd/.goreleaser.yaml b/cmd/.goreleaser.yaml deleted file mode 100644 index f2d4dbc..0000000 --- a/cmd/.goreleaser.yaml +++ /dev/null @@ -1,29 +0,0 @@ -before: - hooks: - - go mod tidy -builds: - - env: - - CGO_ENABLED=0 - goos: - - linux - hooks: - post: - - upx "{{ .Path }}" -archives: - - replacements: - linux: Linux - amd64: x86_64 -checksum: - name_template: 'checksums.txt' -snapshot: - name_template: "{{ incpatch .Version }}-next" -changelog: - sort: asc - filters: - exclude: - - '^docs:' - - '^test:' - -# modelines, feel free to remove those if you don't want/use them: -# yaml-language-server: $schema=https://goreleaser.com/static/schema.json -# vim: set ts=2 sw=2 tw=0 fo=cnqoj