Replace GoReleaser workflow with custom Release pipeline
Some checks failed
Release / goreleaser (push) Failing after 5m10s
Some checks failed
Release / goreleaser (push) Failing after 5m10s
This commit is contained in:
parent
a806b97b9b
commit
265107b66b
37
.github/workflows/go-releaser.yml
vendored
37
.github/workflows/go-releaser.yml
vendored
@ -1,37 +0,0 @@
|
||||
name: goreleaser
|
||||
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- 'v*'
|
||||
|
||||
permissions:
|
||||
contents: 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
|
||||
|
||||
- name: Run GoReleaser
|
||||
uses: goreleaser/goreleaser-action@v5
|
||||
with:
|
||||
distribution: goreleaser
|
||||
version: latest
|
||||
args: release --clean
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Update latest tag
|
||||
run: |
|
||||
git tag -f latest
|
||||
git push -f origin latest
|
98
.github/workflows/release.yml
vendored
Normal file
98
.github/workflows/release.yml
vendored
Normal file
@ -0,0 +1,98 @@
|
||||
name: Release
|
||||
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- "v*"
|
||||
|
||||
permissions:
|
||||
contents: 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
|
||||
|
||||
- name: Set up Git for Gitea
|
||||
run: |
|
||||
git config --global url."https://\token:${{ secrets.API_TOKEN }}@git.mvl.sh/".insteadOf "https://git.mvl.sh/"
|
||||
|
||||
- name: Build binaries
|
||||
id: build
|
||||
run: |
|
||||
# Get version from tag
|
||||
VERSION=${GITHUB_REF#refs/tags/}
|
||||
echo "Building version ${VERSION}..."
|
||||
|
||||
# Set up directories
|
||||
mkdir -p dist/linux_amd64
|
||||
mkdir -p dist/linux_arm64
|
||||
mkdir -p dist/darwin_amd64
|
||||
mkdir -p dist/darwin_arm64
|
||||
|
||||
# Build for different platforms
|
||||
LDFLAGS="-s -w -X git.mvl.sh/vleeuwenmenno/sshtunnel/cmd.Version=${VERSION} -X git.mvl.sh/vleeuwenmenno/sshtunnel/cmd.BuildDate=$(date -u '+%Y-%m-%d %H:%M:%S')"
|
||||
|
||||
# Linux amd64
|
||||
GOOS=linux GOARCH=amd64 go build -ldflags="$LDFLAGS" -o dist/linux_amd64/sshtunnel
|
||||
tar -czf dist/sshtunnel_Linux_x86_64.tar.gz -C dist/linux_amd64 sshtunnel
|
||||
|
||||
# Linux arm64
|
||||
GOOS=linux GOARCH=arm64 go build -ldflags="$LDFLAGS" -o dist/linux_arm64/sshtunnel
|
||||
tar -czf dist/sshtunnel_Linux_arm64.tar.gz -C dist/linux_arm64 sshtunnel
|
||||
|
||||
# macOS amd64
|
||||
GOOS=darwin GOARCH=amd64 go build -ldflags="$LDFLAGS" -o dist/darwin_amd64/sshtunnel
|
||||
tar -czf dist/sshtunnel_Darwin_x86_64.tar.gz -C dist/darwin_amd64 sshtunnel
|
||||
|
||||
# macOS arm64
|
||||
GOOS=darwin GOARCH=arm64 go build -ldflags="$LDFLAGS" -o dist/darwin_arm64/sshtunnel
|
||||
tar -czf dist/sshtunnel_Darwin_arm64.tar.gz -C dist/darwin_arm64 sshtunnel
|
||||
|
||||
# Generate checksums
|
||||
cd dist && sha256sum *.tar.gz > checksums.txt
|
||||
|
||||
- name: Generate completion scripts
|
||||
run: |
|
||||
mkdir -p dist/completions
|
||||
# Generate completion scripts for different shells
|
||||
dist/linux_amd64/sshtunnel completion bash > dist/completions/sshtunnel.bash
|
||||
dist/linux_amd64/sshtunnel completion zsh > dist/completions/sshtunnel.zsh
|
||||
dist/linux_amd64/sshtunnel completion fish > dist/completions/sshtunnel.fish
|
||||
|
||||
- name: Create Gitea Release
|
||||
env:
|
||||
GITEA_TOKEN: ${{ secrets.API_TOKEN }}
|
||||
run: |
|
||||
# Get version from tag
|
||||
VERSION=${GITHUB_REF#refs/tags/}
|
||||
|
||||
# Create release on Gitea
|
||||
curl -X POST \
|
||||
-H "Content-Type: application/json" \
|
||||
-H "Authorization: token $GITEA_TOKEN" \
|
||||
-d "{\"tag_name\": \"$VERSION\", \"name\": \"$VERSION\", \"body\": \"Release $VERSION\"}" \
|
||||
"https://git.mvl.sh/api/v1/repos/vleeuwenmenno/sshtunnel/releases"
|
||||
|
||||
# Upload release assets
|
||||
for file in dist/*.tar.gz dist/checksums.txt; do
|
||||
echo "Uploading $file..."
|
||||
curl -X POST \
|
||||
-H "Authorization: token $GITEA_TOKEN" \
|
||||
-F "attachment=@$file" \
|
||||
"https://git.mvl.sh/api/v1/repos/vleeuwenmenno/sshtunnel/releases/$VERSION/assets"
|
||||
done
|
||||
|
||||
- name: Update latest tag
|
||||
run: |
|
||||
git tag -f latest
|
||||
git push -f origin latest
|
@ -1,9 +1,7 @@
|
||||
# This is a GoReleaser configuration file
|
||||
# For more information about configuration options, visit:
|
||||
# This is a GoReleaser configuration file for sshtunnel
|
||||
# Compatible with GoReleaser v1.26.2
|
||||
# https://goreleaser.com/customization/
|
||||
|
||||
version: 2
|
||||
|
||||
before:
|
||||
hooks:
|
||||
- go mod tidy
|
||||
@ -23,7 +21,6 @@ builds:
|
||||
- -s -w
|
||||
- -X git.mvl.sh/vleeuwenmenno/sshtunnel/cmd.Version={{.Version}}
|
||||
- -X git.mvl.sh/vleeuwenmenno/sshtunnel/cmd.BuildDate={{.Date}}
|
||||
mod_timestamp: "{{ .CommitTimestamp }}"
|
||||
|
||||
archives:
|
||||
- format: tar.gz
|
||||
@ -53,11 +50,7 @@ changelog:
|
||||
|
||||
# Homebrew formula
|
||||
brews:
|
||||
- repository:
|
||||
owner: vleeuwenmenno
|
||||
name: homebrew-tap
|
||||
token: "{{ .Env.GITHUB_TOKEN }}"
|
||||
directory: Formula
|
||||
- name: sshtunnel
|
||||
homepage: "https://git.mvl.sh/vleeuwenmenno/sshtunnel"
|
||||
description: "SSH tunnel manager CLI tool"
|
||||
license: "MIT"
|
||||
@ -82,10 +75,8 @@ brews:
|
||||
# .deb and .rpm packages
|
||||
nfpms:
|
||||
- file_name_template: "{{ .ProjectName }}_{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}"
|
||||
id: packages
|
||||
homepage: https://git.mvl.sh/vleeuwenmenno/sshtunnel
|
||||
description: |-
|
||||
SSH tunnel manager CLI tool
|
||||
description: "SSH tunnel manager CLI tool"
|
||||
maintainer: Menno van Leeuwen
|
||||
license: MIT
|
||||
vendor: vleeuwenmenno
|
||||
@ -98,6 +89,9 @@ nfpms:
|
||||
- bash-completion
|
||||
scripts:
|
||||
postinstall: |
|
||||
mkdir -p /usr/share/bash-completion/completions/
|
||||
mkdir -p /usr/share/zsh/site-functions/
|
||||
mkdir -p /usr/share/fish/vendor_completions.d/
|
||||
sshtunnel completion bash > /usr/share/bash-completion/completions/sshtunnel
|
||||
sshtunnel completion zsh > /usr/share/zsh/site-functions/_sshtunnel
|
||||
sshtunnel completion fish > /usr/share/fish/vendor_completions.d/sshtunnel.fish
|
||||
|
Loading…
x
Reference in New Issue
Block a user