From 8f28826479596d5e3a3d0e4cf19c1af570feb183 Mon Sep 17 00:00:00 2001 From: Devang Solanki <75718583+Devang-Solanki@users.noreply.github.com> Date: Sun, 20 Oct 2024 21:39:42 +0530 Subject: [PATCH] Added release workflow --- .github/workflows/go.yml | 56 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 .github/workflows/go.yml diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml new file mode 100644 index 0000000..2f12839 --- /dev/null +++ b/.github/workflows/go.yml @@ -0,0 +1,56 @@ +name: Build Binaries + +on: + release: + types: [published] + +jobs: + build: + runs-on: ubuntu-latest + + strategy: + matrix: + os: [ubuntu-latest, macos-latest] # OS for building + arch: [amd64, arm64] # Architectures for building + + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Set up Go + uses: actions/setup-go@v2 + with: + go-version: '1.20' # Specify your Go version here + + - name: Build binaries + run: | + if [[ "${{ matrix.os }}" == "ubuntu-latest" ]]; then + if [[ "${{ matrix.arch }}" == "amd64" ]]; then + GOOS=linux GOARCH=amd64 go build . + zip varunastra_linux_amd64.zip myapp + elif [[ "${{ matrix.arch }}" == "arm64" ]]; then + GOOS=linux GOARCH=arm64 go build . + zip varunastra_linux_arm64.zip myapp + fi + elif [[ "${{ matrix.os }}" == "macos-latest" ]]; then + if [[ "${{ matrix.arch }}" == "amd64" ]]; then + GOOS=darwin GOARCH=amd64 go build . + zip varunastra_darwin_amd64.zip myapp + elif [[ "${{ matrix.arch }}" == "arm64" ]]; then + GOOS=darwin GOARCH=arm64 go build . + zip varunastra_darwin_arm64.zip myapp + fi + fi + + - name: Upload binaries to release + uses: softprops/action-gh-release@v1 + with: + tag: ${{ github.event.release.tag_name }} # Use the release tag for the upload + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Automatically provided by GitHub Actions + with: + files: | + varunastra_linux_amd64.zip + varunastra_linux_arm64.zip + varunastra_darwin_amd64.zip + varunastra_darwin_arm64.zip