Skip to content

Add missing pipx

Add missing pipx #55

Workflow file for this run

---
name: Release
on:
push:
tags:
- '*.*.*'
permissions:
contents: write
packages: write
env:
GO_VERSION: '1.25.5'
jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
cache: true
cache-dependency-path: go.sum
- name: Get version from tag
id: get_version
run: |
VERSION=${GITHUB_REF#refs/tags/}
echo "VERSION=$VERSION" >> "$GITHUB_ENV"
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
if [ -z "$VERSION" ]; then
echo "Error: VERSION is empty"
exit 1
fi
- name: Download dependencies
run: go mod download
- name: Verify dependencies
run: go mod verify
- name: Sync VERSION file with tag
run: echo "${{ env.VERSION }}" > VERSION
- name: Run tests
run: make test-ci
- name: Run linter
uses: golangci/golangci-lint-action@v4
with:
version: latest
args: --timeout=5m
continue-on-error: true
- name: Build release artifacts
env:
VERSION: ${{ env.VERSION }}
run: |
make VERSION="${VERSION}" release
ls -la dist/
# ----------------------------------------------------------------
# NEW: Create Universal Binary for Homebrew Tap
# ----------------------------------------------------------------
- name: Create macOS Universal Binary
run: |
# Install llvm to get llvm-lipo
sudo apt-get update && sudo apt-get install -y llvm
# Ensure llvm-lipo is available
if ! command -v llvm-lipo &> /dev/null; then
# Try to find versioned llvm-lipo and symlink it
LIPO_PATH=$(find /usr/bin -name "llvm-lipo-*" | head -n 1)
if [ -n "$LIPO_PATH" ]; then
sudo ln -s "$LIPO_PATH" /usr/bin/llvm-lipo
else
echo "Error: llvm-lipo not found"
exit 1
fi
fi
# Create universal binary using llvm-lipo
llvm-lipo -create -output dist/construct dist/construct-darwin-amd64 dist/construct-darwin-arm64
# Verify it is universal
file dist/construct
# Create the specific tarball expected by the tap
tar -czf dist/construct-cli-macos-universal.tar.gz -C dist construct
# Cleanup temporary binary
rm dist/construct
# ----------------------------------------------------------------
# NEW: Prepare Linux Artifacts for Homebrew Tap
# ----------------------------------------------------------------
- name: Prepare Linux Artifacts
run: |
# Package Linux binaries as "construct" for the tap
mkdir -p dist/linux-amd64 dist/linux-arm64
cp dist/construct-linux-amd64 dist/linux-amd64/construct
cp dist/construct-linux-arm64 dist/linux-arm64/construct
tar -czf dist/construct-cli-linux-amd64.tar.gz -C dist/linux-amd64 construct
tar -czf dist/construct-cli-linux-arm64.tar.gz -C dist/linux-arm64 construct
rm -rf dist/linux-amd64 dist/linux-arm64
- name: Verify release outputs
env:
VERSION: ${{ env.VERSION }}
run: |
set -e
expected_files=(
"dist/construct-darwin-arm64"
"dist/construct-darwin-amd64"
"dist/construct-linux-amd64"
"dist/construct-linux-arm64"
"dist/construct-cli-macos-universal.tar.gz"
"dist/construct-cli-linux-amd64.tar.gz"
"dist/construct-cli-linux-arm64.tar.gz"
"dist/checksums.txt"
)
for file in "${expected_files[@]}"; do
if [ -f "${file}" ]; then
size=$(stat -c%s "${file}")
echo "✅ ${file} (size: ${size} bytes)"
else
echo "❌ Missing expected artifact: ${file}"
missing="yes"
fi
done
if [ "${missing:-no}" = "yes" ]; then
exit 1
fi
- name: Create Release Notes
env:
VERSION: ${{ env.VERSION }}
run: |
release_date=""
if [ -f CHANGELOG.md ]; then
# Use portable awk (works with mawk)
release_date=$(awk -v ver="$VERSION" '
$0 ~ "^## \\["ver"\\] - " {
sub(/^## \[[^]]+\] - /, "");
print $0;
exit;
}' CHANGELOG.md)
fi
if [ -n "$release_date" ]; then
release_title="The Construct CLI $VERSION - $release_date"
else
release_title="The Construct CLI $VERSION"
fi
echo "RELEASE_TITLE=$release_title" >> "$GITHUB_ENV"
printf "## Release Notes\n\n" > release_notes.md
if [ -f CHANGELOG.md ]; then
awk -v ver="$VERSION" '
$0 ~ "^## \\["ver"\\] - " {found=1; next}
found && $0 ~ "^---" {exit}
found {print}
' CHANGELOG.md | sed '1{/^$/d;}' >> release_notes.md
else
echo "- See commit history for details." >> release_notes.md
fi
- name: Create GitHub Release
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ env.VERSION }}
name: ${{ env.RELEASE_TITLE }}
body_path: release_notes.md
draft: false
prerelease: false
files: |
dist/construct-darwin-arm64-${{ env.VERSION }}.tar.gz
dist/construct-darwin-amd64-${{ env.VERSION }}.tar.gz
dist/construct-linux-amd64-${{ env.VERSION }}.tar.gz
dist/construct-linux-arm64-${{ env.VERSION }}.tar.gz
dist/construct-cli-macos-universal.tar.gz
dist/construct-cli-linux-amd64.tar.gz
dist/construct-cli-linux-arm64.tar.gz
dist/checksums.txt
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Update VERSION file
env:
VERSION: ${{ env.VERSION }}
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add VERSION
git commit -m "chore: update VERSION to $VERSION" || echo "No changes to commit"
git push origin HEAD:main || echo "Failed to push VERSION file update"
update-tap:
needs: release
runs-on: ubuntu-latest
steps:
- name: Trigger Homebrew Tap Update
uses: actions/github-script@v8
with:
github-token: ${{ secrets.TAP_GITHUB_TOKEN }}
script: |
await github.rest.actions.createWorkflowDispatch({
owner: 'EstebanForge',
repo: 'homebrew-tap',
workflow_id: 'update-formula.yml',
ref: 'main',
inputs: {
formula: 'construct-cli',
tag: '${{ github.ref_name }}',
repository: '${{ github.repository }}'
}
})