Fix CI workflow issues and improve code quality (#1) #2
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Release | |
on: | |
push: | |
tags: | |
- 'v*' | |
permissions: | |
contents: write | |
packages: write | |
jobs: | |
release: | |
name: Release | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 # Full history for changelog | |
- name: Set up Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version: '1.24' | |
- name: Cache Go modules | |
uses: actions/cache@v4 | |
with: | |
path: ~/go/pkg/mod | |
key: ${{ runner.os }}-go-1.24-${{ hashFiles('**/go.sum') }} | |
restore-keys: | | |
${{ runner.os }}-go-1.24- | |
${{ runner.os }}-go- | |
- name: Download dependencies | |
run: go mod download | |
- name: Verify dependencies | |
run: go mod verify | |
- name: Run tests | |
run: go test -v -short ./... | |
- name: Run GoReleaser | |
uses: goreleaser/goreleaser-action@v5 | |
with: | |
distribution: goreleaser | |
version: latest | |
args: release --clean | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
# For Homebrew tap updates (if using a separate tap repo) | |
TAP_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Upload release summary | |
run: | | |
echo "## 🎉 Release ${{ github.ref_name }} Published!" >> $GITHUB_STEP_SUMMARY | |
echo "" >> $GITHUB_STEP_SUMMARY | |
echo "### 📦 Assets Built:" >> $GITHUB_STEP_SUMMARY | |
echo "- ✅ Linux (amd64, arm64)" >> $GITHUB_STEP_SUMMARY | |
echo "- ✅ macOS (amd64, arm64)" >> $GITHUB_STEP_SUMMARY | |
echo "- ✅ Windows (amd64)" >> $GITHUB_STEP_SUMMARY | |
echo "- ✅ Checksums generated" >> $GITHUB_STEP_SUMMARY | |
echo "" >> $GITHUB_STEP_SUMMARY | |
echo "### 🚀 Installation:" >> $GITHUB_STEP_SUMMARY | |
echo '```bash' >> $GITHUB_STEP_SUMMARY | |
echo "# Download binary for your platform from release assets above" >> $GITHUB_STEP_SUMMARY | |
echo "# Extract and verify:" >> $GITHUB_STEP_SUMMARY | |
echo "kubectx-manager version" >> $GITHUB_STEP_SUMMARY | |
echo '```' >> $GITHUB_STEP_SUMMARY |