From c6db3ceed0d5e302a152c4ba24d8e45b70874646 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=CE=A3rebe=20-=20Romain=20GERARD?= Date: Wed, 18 Oct 2023 15:04:13 +0200 Subject: [PATCH] Add go-releaser Former-commit-id: c4cbac36a48488fb51c185e5395c97658b2fb2cb [formerly ff09ed34580c5f0df173d8e336ec59ec78335b45] [formerly 4b7f06b3229836b65b71c36bc84e444ed5288f19 [formerly 2fbc36220d1aa97f004edc61664803f8accca190]] Former-commit-id: 6e848d671882f9370d3268cbba0a0bb2bf4ddb7c [formerly d863ebcf7b5af0f7be2bdab0e3817905541cb928] Former-commit-id: a2066abc87831c029c7cc36cabc434ba106daed6 Former-commit-id: 766db1f704fc7fdc95eed150567d50e987757586 Former-commit-id: c85132ea4129a759d6cac0b7395582f7ab03ecb8 Former-commit-id: 6c3f3d824292701b2ab9bc30598854560a74359d [formerly 55a9c8bbb5212a4c78e90ea6e8588ffd2b45ea7c] Former-commit-id: 92ec5f403dac14ee7388a0893a5bb7bee25266ba --- .github/workflows/release.yaml | 11 +++++++++++ .goreleaser.yaml | 26 ++++++++++++++++++++++++++ .goreleaser_hook.sh | 22 ++++++++++++++++++++++ goreleaser.go | 3 +++ 4 files changed, 62 insertions(+) create mode 100644 .goreleaser.yaml create mode 100755 .goreleaser_hook.sh create mode 100644 goreleaser.go diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 74333b3..820eb6c 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -113,3 +113,14 @@ jobs: - uses: actions/download-artifact@v3 with: path: artifacts + + # Goreleaser + - name: Set up Go + uses: actions/setup-go@v4 + - name: Run GoReleaser + uses: goreleaser/goreleaser-action@v5 + with: + distribution: goreleaser + version: latest + # Run goreleaser and ignore non-committed files (downloaded artifacts) + args: release --clean --skip=validate diff --git a/.goreleaser.yaml b/.goreleaser.yaml new file mode 100644 index 0000000..6cacdb5 --- /dev/null +++ b/.goreleaser.yaml @@ -0,0 +1,26 @@ +project_name: wstunnel +builds: + - main: goreleaser.go + goos: + - linux + - darwin + - windows + goarch: + - amd64 + - arm64 + binary: example + ignore: + - goos: windows + goarch: arm64 + hooks: + post: + - ./.goreleaser_hook.sh {{ .Arch }} {{ .Os }} {{ .ProjectName }} +checksum: + name_template: "checksums.txt" +changelog: + sort: asc + filters: + exclude: + - "^docs:" + - "^test:" + diff --git a/.goreleaser_hook.sh b/.goreleaser_hook.sh new file mode 100755 index 0000000..11ef8b6 --- /dev/null +++ b/.goreleaser_hook.sh @@ -0,0 +1,22 @@ +#!/usr/bin/env bash + +go_arch=$1 +go_os=$2 +project_name=$3 + +# Make Go -> Rust arch/os mapping +case $go_arch in + amd64) rust_arch='x86_64' ;; + arm64) rust_arch='aarch64' ;; + *) echo "unknown arch: $go_arch" && exit 1 ;; +esac +case $go_os in + linux) rust_os='linux' ;; + darwin) rust_os='apple-darwin' ;; + windows) rust_os='windows' ;; + *) echo "unknown os: $go_os" && exit 1 ;; +esac + +# Find artifacts and uncompress in the corresponding directory +find artifacts -type f -name "*${rust_arch}*${rust_os}*" -exec unzip -d dist/${project_name}_${go_os}_${go_arch} {} \; + diff --git a/goreleaser.go b/goreleaser.go new file mode 100644 index 0000000..73c71de --- /dev/null +++ b/goreleaser.go @@ -0,0 +1,3 @@ +package main + func main() { +}