Skip to content

chore: release CLI v1.5.52 and SDK v0.8.0 #104

chore: release CLI v1.5.52 and SDK v0.8.0

chore: release CLI v1.5.52 and SDK v0.8.0 #104

Workflow file for this run

# Used by aerostackdev/cli repo. Tag format: v1.2.2 OR cli/v1.2.2 (both work)
name: Release
on:
push:
tags:
- 'v*'
- 'cli/v*'
workflow_dispatch:
permissions:
contents: write
jobs:
goreleaser:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ github.ref }}
- name: Set up Zig
uses: goto-bus-stop/setup-zig@v2
with:
version: "0.14.0"
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.21'
- name: Set tag for GoReleaser (strip cli/ prefix if present)
run: |
TAG="${GITHUB_REF#refs/tags/}"
echo "GORELEASER_CURRENT_TAG=${TAG#cli/}" >> $GITHUB_ENV
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v6
with:
distribution: goreleaser
version: v2.2.0
args: release --clean --skip=validate
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
macos-assets:
needs: goreleaser
strategy:
matrix:
arch: [amd64, arm64]
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ github.ref }}
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod
- name: Build and upload macOS archive
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
TAG="${GITHUB_REF#refs/tags/}"
RELEASE_TAG="${TAG#cli/}" # keep v-prefix for release tag
VERSION="${RELEASE_TAG#v}" # strip v-prefix for filename
BUILD_DATE="$(date -u +%Y-%m-%dT%H:%M:%SZ)"
OUT_DIR="dist/macos"
BIN_PATH="${OUT_DIR}/aerostack_${VERSION}_darwin_${{ matrix.arch }}"
PKG_DIR="${OUT_DIR}/pkg_${{ matrix.arch }}"
ARCHIVE="aerostack_${VERSION}_darwin_${{ matrix.arch }}.tar.gz"
mkdir -p "$OUT_DIR" "$PKG_DIR"
CGO_ENABLED=1 GOOS=darwin GOARCH=${{ matrix.arch }} go build \
-trimpath \
-ldflags "-s -w -X main.version=${VERSION} -X main.commit=${GITHUB_SHA} -X main.date=${BUILD_DATE}" \
-o "$BIN_PATH" ./cmd/aerostack
cp "$BIN_PATH" "${PKG_DIR}/aerostack"
tar -C "$PKG_DIR" -czf "$ARCHIVE" aerostack
gh release upload "$RELEASE_TAG" "$ARCHIVE" --clobber
windows-assets:
needs: goreleaser
strategy:
matrix:
arch: [amd64]
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ github.ref }}
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod
- name: Build and upload Windows archive
shell: pwsh
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
$tag = "${env:GITHUB_REF}" -replace '^refs/tags/', ''
$releaseTag = $tag -replace '^cli/', ''
$version = $releaseTag -replace '^v', ''
$buildDate = (Get-Date -AsUTC).ToString("yyyy-MM-ddTHH:mm:ssZ")
$outDir = "dist/windows"
$binPath = "${outDir}/aerostack_${version}_windows_${{ matrix.arch }}.exe"
$pkgDir = "${outDir}/pkg_${{ matrix.arch }}"
$archive = "aerostack_${version}_windows_${{ matrix.arch }}.zip"
New-Item -ItemType Directory -Path $outDir -Force | Out-Null
New-Item -ItemType Directory -Path $pkgDir -Force | Out-Null
$env:CGO_ENABLED = "1"
$env:GOOS = "windows"
$env:GOARCH = "${{ matrix.arch }}"
go build -trimpath `
-ldflags "-s -w -X main.version=$version -X main.commit=${env:GITHUB_SHA} -X main.date=$buildDate" `
-o $binPath ./cmd/aerostack
Copy-Item $binPath "${pkgDir}/aerostack.exe" -Force
if (Test-Path $archive) { Remove-Item $archive -Force }
Compress-Archive -Path "${pkgDir}/aerostack.exe" -DestinationPath $archive
gh release upload $releaseTag $archive --clobber