Skip to content

fix: support channel configuration in subscription creation (#5) #17

fix: support channel configuration in subscription creation (#5)

fix: support channel configuration in subscription creation (#5) #17

Workflow file for this run

name: Build and Publish Golang Binary
on:
push:
branches: [ main, develop ]
tags: [ 'v*' ]
paths:
- 'main.go'
- 'cmd/**'
- 'pkg/**'
- 'go.mod'
- 'go.sum'
pull_request:
branches: [ main, develop ]
paths:
- 'main.go'
- 'cmd/**'
- 'pkg/**'
- 'go.mod'
- 'go.sum'
env:
BINARY_NAME: upgrade
jobs:
# Build and publish Golang binary
build:
name: Build and Publish Binary
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
go-version: [1.24.0]
arch: [amd64, arm64]
permissions:
contents: read
actions: write
if: github.event_name == 'push' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/'))
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: ${{ matrix.go-version }}
cache: true
- name: Create dist directory
run: mkdir -p dist
- name: Build binary
env:
GOOS: ${{ matrix.os == 'macos-latest' && 'darwin' || 'linux' }}
GOARCH: ${{ matrix.arch }}
CGO_ENABLED: 0
run: |
# Build the binary
go build -ldflags="-s -w -X main.version=${{ github.ref_name }} -X main.commit=${{ github.sha }} -X main.date=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" \
-o "dist/${{ env.BINARY_NAME }}-${{ matrix.os }}-${{ matrix.arch }}" \
.
# Create checksum file
if [[ "${{ matrix.os }}" == "macos-latest" ]]; then
shasum -a 256 "dist/${{ env.BINARY_NAME }}-${{ matrix.os }}-${{ matrix.arch }}" > "dist/${{ env.BINARY_NAME }}-${{ matrix.os }}-${{ matrix.arch }}.sha256"
else
shasum -a 256 "dist/${{ env.BINARY_NAME }}-${{ matrix.os }}-${{ matrix.arch }}" > "dist/${{ env.BINARY_NAME }}-${{ matrix.os }}-${{ matrix.arch }}.sha256"
fi
# List files for debugging
ls -la dist/
- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: binary-${{ matrix.os }}-${{ matrix.arch }}
path: dist/
retention-days: 30
# Create release
release:
name: Create Release
runs-on: ubuntu-latest
needs: build
if: startsWith(github.ref, 'refs/tags/')
permissions:
contents: write
actions: read
steps:
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: dist/
- name: List downloaded artifacts
run: |
echo "Downloaded artifacts:"
find dist/ -type f -exec ls -la {} \;
- name: Create Release
uses: softprops/action-gh-release@v1
with:
files: dist/**/*
draft: false
prerelease: false
generate_release_notes: true