Merge pull request #1 from ai-112/main #9
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 SQL Parser Binary | |
| on: | |
| push: | |
| tags: | |
| - "v*" | |
| permissions: | |
| contents: write | |
| jobs: | |
| build-and-release: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Go | |
| uses: actions/setup-go@v4 | |
| with: | |
| go-version: "1.21" | |
| - name: Build binaries | |
| run: | | |
| BINARY_NAME="sqlparser" | |
| VERSION=${GITHUB_REF#refs/tags/} | |
| BUILD_PATH="cmd/sqlparser/main.go" | |
| # Build for Linux | |
| GOOS=linux GOARCH=amd64 go build -o "${BINARY_NAME}-linux-amd64" ${BUILD_PATH} | |
| tar czf "${BINARY_NAME}-linux-amd64.tar.gz" "${BINARY_NAME}-linux-amd64" | |
| # Build for macOS | |
| GOOS=darwin GOARCH=amd64 go build -o "${BINARY_NAME}-darwin-amd64" ${BUILD_PATH} | |
| tar czf "${BINARY_NAME}-darwin-amd64.tar.gz" "${BINARY_NAME}-darwin-amd64" | |
| # Build for Windows | |
| GOOS=windows GOARCH=amd64 go build -o "${BINARY_NAME}-windows-amd64.exe" ${BUILD_PATH} | |
| zip "${BINARY_NAME}-windows-amd64.zip" "${BINARY_NAME}-windows-amd64.exe" | |
| - name: Create Release | |
| uses: softprops/action-gh-release@v1 | |
| with: | |
| files: | | |
| sqlparser-linux-amd64.tar.gz | |
| sqlparser-darwin-amd64.tar.gz | |
| sqlparser-windows-amd64.zip | |
| draft: false | |
| prerelease: false | |
| generate_release_notes: true |