diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..a8ce640 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,54 @@ +name: Build and Release Go Binary + +on: + push: + tags: + - "v*" + +jobs: + build: + name: Build Go Binary + runs-on: ubuntu-latest + + steps: + - name: Checkout Code + uses: actions/checkout@v4 + + - name: Set up Go + uses: actions/setup-go@v5 + with: + go-version: 1.23 + + - name: Build Binary + run: | + mkdir -p dist + GOOS=linux GOARCH=amd64 go build -o dist/go-mines-linux-amd64 . + GOOS=windows GOARCH=amd64 go build -o dist/go-mines-windows-amd64.exe . + GOOS=darwin GOARCH=amd64 go build -o dist/go-mines-macos-amd64 . + + - name: Upload Build Artifacts + uses: actions/upload-artifact@v4 + with: + name: go-mines-binaries + path: dist/* + + release: + name: Create GitHub Release + needs: build + runs-on: ubuntu-latest + steps: + - name: Checkout Code + uses: actions/checkout@v4 + + - name: Download Build Artifacts + uses: actions/download-artifact@v4 + with: + name: go-mines-binaries + path: dist + + - name: Create GitHub Release + uses: softprops/action-gh-release@v2 + with: + files: dist/* + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}