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
This commit is contained in:
Σrebe - Romain GERARD 2023-10-18 15:04:13 +02:00
parent b30bd381e1
commit c6db3ceed0
4 changed files with 62 additions and 0 deletions

View file

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

26
.goreleaser.yaml Normal file
View file

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

22
.goreleaser_hook.sh Executable file
View file

@ -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} {} \;

3
goreleaser.go Normal file
View file

@ -0,0 +1,3 @@
package main
func main() {
}