dbqcore v0.0.5 #8
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 dbqctl | |
| on: | |
| push: | |
| tags: | |
| # trigger on tags like v1.0.0, v1.2.3 etc. | |
| - 'v*.*.*' | |
| env: | |
| APP_NAME: dbqctl | |
| MAIN_PACKAGE_PATH: . | |
| permissions: | |
| contents: write | |
| jobs: | |
| build: | |
| name: Build Binaries | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| include: | |
| - goos: linux | |
| goarch: amd64 | |
| asset_suffix: linux-amd64 | |
| # - goos: linux | |
| # goarch: arm64 | |
| # asset_suffix: linux-arm64 | |
| # - goos: darwin # macOS | |
| # goarch: amd64 | |
| # asset_suffix: darwin-amd64 | |
| - goos: darwin # macOS | |
| goarch: arm64 | |
| asset_suffix: darwin-arm64 | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Set up Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version: '1.24.2' | |
| - name: Get dependencies | |
| run: go mod tidy -e | |
| - name: Build Go application | |
| env: | |
| GOOS: ${{ matrix.goos }} | |
| GOARCH: ${{ matrix.goarch }} | |
| run: | | |
| # Construct the output binary name | |
| BINARY_NAME="${{ env.APP_NAME }}-${{ matrix.asset_suffix }}" | |
| go build -v -ldflags="-s -w" -o "build/${BINARY_NAME}" ${{ env.MAIN_PACKAGE_PATH }} | |
| echo "Built: build/${BINARY_NAME}" | |
| - name: Compress binary (Linux/macOS) | |
| if: matrix.goos == 'linux' || matrix.goos == 'darwin' | |
| run: | | |
| BINARY_NAME="${{ env.APP_NAME }}-${{ matrix.asset_suffix }}" | |
| ARCHIVE_NAME="${BINARY_NAME}.tar.gz" | |
| cd build | |
| tar czf "../${ARCHIVE_NAME}" "${BINARY_NAME}" | |
| cd .. | |
| echo "Compressed: ${ARCHIVE_NAME}" | |
| echo "ASSET_PATH=${ARCHIVE_NAME}" >> $GITHUB_ENV | |
| echo "ASSET_NAME=${ARCHIVE_NAME}" >> $GITHUB_ENV | |
| - name: Upload artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ${{ env.ASSET_NAME }} | |
| path: ${{ env.ASSET_PATH }} | |
| retention-days: 1 | |
| release: | |
| name: Create GitHub Release | |
| needs: build | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Download all build artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| path: release-assets | |
| - name: List downloaded files | |
| run: ls -lah release-assets | |
| - name: Create GitHub Release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| tag_name: ${{ github.ref_name }} | |
| name: Release ${{ github.ref_name }} | |
| generate_release_notes: true | |
| files: release-assets/*/* |