From a3bc3003c0b57e26337d8376915ac899bc25714d Mon Sep 17 00:00:00 2001 From: Dmitrii Gridnev Date: Thu, 12 Dec 2024 15:41:41 +0100 Subject: [PATCH] feat: add GitHub Actions pipeline for cross-platform release builds - Configured GitHub Actions to build binaries for Linux, macOS, and Windows - Added support for amd64 and arm64 architectures - Automatically generates release notes and attaches compiled binaries to the GitHub release - Ensures cross-platform compatibility for the release artifacts #57 --- .github/workflows/release.yml | 49 +++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..2c505ff --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,49 @@ +name: Create Release on Tag + +on: + push: + tags: + - 'v*' + +jobs: + build_and_release: + runs-on: ubuntu-latest + + strategy: + matrix: + os: [ linux, windows, darwin ] + arch: [ amd64, arm64 ] + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set up Go + uses: actions/setup-go@v5 + with: + go-version: '1.21' + + - name: Build the binary for ${{ matrix.os }}-${{ matrix.arch }} + run: | + GOOS=${{ matrix.os }} GOARCH=${{ matrix.arch }} go build -o "build/qasectl-${{ matrix.os }}-${{ matrix.arch }}" ./cmd + + - name: Generate release notes + id: release_notes + run: | + RELEASE_NOTES=$(git log --oneline $(git describe --tags --abbrev=0)..HEAD) + echo "::set-output name=notes::$RELEASE_NOTES" + + - name: Create GitHub release + uses: softprops/action-gh-release@v2 + with: + files: | + build/qasectl-linux-amd64 + build/qasectl-linux-arm64 + build/qasectl-darwin-amd64 + build/qasectl-darwin-arm64 + build/qasectl-windows-amd64.exe + build/qasectl-windows-arm64.exe + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + RELEASE_NAME: Release ${{ github.ref }} + BODY: ${{ steps.release_notes.outputs.notes }}