Skip to content

Pivoting to goreleaser for AUR #25

Pivoting to goreleaser for AUR

Pivoting to goreleaser for AUR #25

Workflow file for this run

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: '1.24'
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v6
with:
distribution: goreleaser
version: latest
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
AUR_SSH_KEY: ${{ secrets.AUR_SSH_KEY }}
docker:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Extract version from tag
id: version
run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT
- name: Build and Push Docker Image
uses: docker/build-push-action@v6
with:
context: .
push: true
tags: |
meldrum123454/go-send:latest
meldrum123454/go-send:${{ steps.version.outputs.VERSION }}
homebrew-update:
needs: goreleaser
runs-on: ubuntu-latest
steps:
- name: Extract version from tag
id: version
run: |
VERSION="${GITHUB_REF#refs/tags/v}"
echo "version=$VERSION" >> $GITHUB_OUTPUT
echo "tag=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
- name: Download release assets and calculate SHA256
id: sha256
run: |
VERSION="${{ steps.version.outputs.version }}"
TAG="${{ steps.version.outputs.tag }}"
# Download all platform archives
wget -q "https://github.com/VinMeld/go-send/releases/download/${TAG}/go-send_${VERSION}_darwin_arm64.tar.gz"
wget -q "https://github.com/VinMeld/go-send/releases/download/${TAG}/go-send_${VERSION}_darwin_amd64.tar.gz"
wget -q "https://github.com/VinMeld/go-send/releases/download/${TAG}/go-send_${VERSION}_linux_arm64.tar.gz"
wget -q "https://github.com/VinMeld/go-send/releases/download/${TAG}/go-send_${VERSION}_linux_amd64.tar.gz"
# Calculate SHA256 hashes
echo "darwin_arm64_sha=$(shasum -a 256 go-send_${VERSION}_darwin_arm64.tar.gz | awk '{print $1}')" >> $GITHUB_OUTPUT
echo "darwin_amd64_sha=$(shasum -a 256 go-send_${VERSION}_darwin_amd64.tar.gz | awk '{print $1}')" >> $GITHUB_OUTPUT
echo "linux_arm64_sha=$(shasum -a 256 go-send_${VERSION}_linux_arm64.tar.gz | awk '{print $1}')" >> $GITHUB_OUTPUT
echo "linux_amd64_sha=$(shasum -a 256 go-send_${VERSION}_linux_amd64.tar.gz | awk '{print $1}')" >> $GITHUB_OUTPUT
- name: Checkout homebrew-tap
uses: actions/checkout@v4
with:
repository: VinMeld/homebrew-tap
token: ${{ secrets.HOMEBREW_TAP_TOKEN }}
path: homebrew-tap
- name: Update Homebrew formula
run: |
cat > homebrew-tap/Formula/go-send.rb << 'EOF'
class GoSend < Formula
desc "Secure, end-to-end encrypted file sharing with store-and-forward"
homepage "https://github.com/VinMeld/go-send"
version "${{ steps.version.outputs.version }}"
license "GPL-3.0"
on_macos do
on_arm do
url "https://github.com/VinMeld/go-send/releases/download/${{ steps.version.outputs.tag }}/go-send_${{ steps.version.outputs.version }}_darwin_arm64.tar.gz"
sha256 "${{ steps.sha256.outputs.darwin_arm64_sha }}"
end
on_intel do
url "https://github.com/VinMeld/go-send/releases/download/${{ steps.version.outputs.tag }}/go-send_${{ steps.version.outputs.version }}_darwin_amd64.tar.gz"
sha256 "${{ steps.sha256.outputs.darwin_amd64_sha }}"
end
end
on_linux do
on_arm do
url "https://github.com/VinMeld/go-send/releases/download/${{ steps.version.outputs.tag }}/go-send_${{ steps.version.outputs.version }}_linux_arm64.tar.gz"
sha256 "${{ steps.sha256.outputs.linux_arm64_sha }}"
end
on_intel do
url "https://github.com/VinMeld/go-send/releases/download/${{ steps.version.outputs.tag }}/go-send_${{ steps.version.outputs.version }}_linux_amd64.tar.gz"
sha256 "${{ steps.sha256.outputs.linux_amd64_sha }}"
end
end
def install
bin.install "go-send"
end
test do
assert_match "go-send", shell_output("#{bin}/go-send --help 2>&1")
end
def caveats
<<~EOS
To get started with go-send:
1. Initialize: go-send config init --user <username>
2. Set server: go-send set-server <server-url>
3. Register: go-send register --token <token>
Documentation: https://github.com/VinMeld/go-send
EOS
end
end
EOF
- name: Commit and push to homebrew-tap
run: |
cd homebrew-tap
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git add Formula/go-send.rb
git commit -m "Update go-send to ${{ steps.version.outputs.version }}"
git push