Skip to content

release: prepare v0.13.1 #35

release: prepare v0.13.1

release: prepare v0.13.1 #35

Workflow file for this run

name: Release
on:
push:
tags:
- 'v*.*.*'
permissions:
contents: write
packages: write
env:
GO_VERSION: '1.24'
jobs:
build:
name: Build (${{ matrix.target }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
target: linux_amd64
goos: linux
goarch: amd64
zip_extension: tar.gz
- os: ubuntu-latest
target: linux_arm64
goos: linux
goarch: arm64
zip_extension: tar.gz
- os: macos-latest
target: darwin_amd64
goos: darwin
goarch: amd64
zip_extension: tar.gz
- os: macos-latest
target: darwin_arm64
goos: darwin
goarch: arm64
zip_extension: tar.gz
- os: windows-latest
target: windows_amd64
goos: windows
goarch: amd64
binary_ext: .exe
zip_extension: zip
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
cache: true
- name: Get version
id: version
shell: bash
run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT
- name: Build binary
shell: bash
env:
CGO_ENABLED: 0
GOOS: ${{ matrix.goos }}
GOARCH: ${{ matrix.goarch }}
run: |
COMMIT=$(git rev-parse --short HEAD)
DATE=$(date -u +%Y-%m-%dT%H:%M:%SZ)
go build -trimpath -ldflags "-X main.Version=${{ steps.version.outputs.VERSION }} -X main.Commit=$COMMIT -X main.BuildDate=$DATE" \
-o arbor-${{ steps.version.outputs.VERSION }}-${{ matrix.target }}${{ matrix.binary_ext }} ./cmd/arbor
- name: Create archive (tar.gz)
if: matrix.zip_extension == 'tar.gz'
run: tar -czf arbor-${{ steps.version.outputs.VERSION }}-${{ matrix.target }}.${{ matrix.zip_extension }} arbor-${{ steps.version.outputs.VERSION }}-${{ matrix.target }}${{ matrix.binary_ext }}
- name: Create archive (zip)
if: matrix.zip_extension == 'zip'
shell: pwsh
run: |
$version = $env:GITHUB_REF -replace 'refs/tags/v', ''
$target = "${{ matrix.target }}"
7z a "arbor-$version-$target.zip" "arbor-$version-$target.exe"
- name: Generate checksum
shell: bash
run: sha256sum arbor-${{ steps.version.outputs.VERSION }}-${{ matrix.target }}.${{ matrix.zip_extension }} > arbor-${{ steps.version.outputs.VERSION }}-${{ matrix.target }}.sha256
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: arbor-${{ matrix.target }}
path: |
arbor-${{ steps.version.outputs.VERSION }}-${{ matrix.target }}.${{ matrix.zip_extension }}
arbor-${{ steps.version.outputs.VERSION }}-${{ matrix.target }}.sha256
create-release:
name: Create Release
needs: build
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Fetch tags with annotations
run: git fetch --tags --force
- name: Get version
id: version
run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT
- name: Get previous tag
id: previous_tag
run: |
PREVIOUS=$(git describe --tags --abbrev=0 "v${{ steps.version.outputs.VERSION }}^" 2>/dev/null || echo "")
echo "PREVIOUS=$PREVIOUS" >> $GITHUB_OUTPUT
- name: Get tag annotation
id: tag_annotation
run: |
ANNOTATION=$(git tag -l --format='%(contents)' "v${{ steps.version.outputs.VERSION }}")
echo "ANNOTATION<<EOF" >> $GITHUB_OUTPUT
echo "$ANNOTATION" >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
- name: Build release body
id: release_body
run: |
PREVIOUS="${{ steps.previous_tag.outputs.PREVIOUS }}"
CURRENT="v${{ steps.version.outputs.VERSION }}"
{
echo "BODY<<EOF"
echo "${{ steps.tag_annotation.outputs.ANNOTATION }}"
if [ -n "$PREVIOUS" ]; then
echo ""
echo ""
echo "**Full changelog:** [$PREVIOUS..$CURRENT](https://github.com/${{ github.repository }}/compare/$PREVIOUS..$CURRENT)"
fi
echo "EOF"
} >> $GITHUB_OUTPUT
- name: Download artifacts
uses: actions/download-artifact@v4
with:
path: release-artifacts
merge-multiple: true
- name: Generate checksums file
run: |
cd release-artifacts
cat *.sha256 > checksums.txt
cat checksums.txt
- name: Create Release
uses: softprops/action-gh-release@v2
with:
tag_name: v${{ steps.version.outputs.VERSION }}
name: v${{ steps.version.outputs.VERSION }}
body: ${{ steps.release_body.outputs.BODY }}
files: release-artifacts/*
- name: Trigger Homebrew formula update
env:
GH_TOKEN: ${{ secrets.HOMEBREW_TAP_TOKEN }}
run: |
gh api repos/artisanexperiences/homebrew-tap/dispatches \
--method POST \
--field event_type=update-formula \
--field client_payload[version]="${{ steps.version.outputs.VERSION }}" \
--field client_payload[repository]="${{ github.repository }}"