chore(deps): update dependency go to v1.25.1 (#7) #29
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: Build and Release | |
| on: | |
| push: | |
| branches: [ main] | |
| pull_request: | |
| branches: [ main ] | |
| workflow_dispatch: | |
| permissions: | |
| contents: write | |
| packages: write | |
| jobs: | |
| build: | |
| name: Build | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| goos: [linux, windows, darwin] | |
| goarch: [amd64, arm64, "386", arm] | |
| exclude: | |
| # Exclude unsupported combinations | |
| - goos: darwin | |
| goarch: "386" | |
| - goos: darwin | |
| goarch: arm | |
| - goos: windows | |
| goarch: arm | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - name: Set up Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version: '1.25.1' | |
| - name: Get dependencies | |
| run: go mod download | |
| - name: Build | |
| env: | |
| GOOS: ${{ matrix.goos }} | |
| GOARCH: ${{ matrix.goarch }} | |
| run: | | |
| # Create output directory | |
| mkdir -p dist | |
| # Set binary name based on OS | |
| BINARY_NAME="flac-converter" | |
| if [ "${{ matrix.goos }}" = "windows" ]; then | |
| BINARY_NAME="flac-converter.exe" | |
| fi | |
| # Set output filename with architecture info | |
| OUTPUT_NAME="flac-converter-${{ matrix.goos }}-${{ matrix.goarch }}" | |
| if [ "${{ matrix.goos }}" = "windows" ]; then | |
| OUTPUT_NAME="flac-converter-${{ matrix.goos }}-${{ matrix.goarch }}.exe" | |
| fi | |
| # Build the binary | |
| go build -ldflags="-s -w" -o "dist/${OUTPUT_NAME}" . | |
| # Create archive | |
| if [ "${{ matrix.goos }}" = "windows" ]; then | |
| cd dist && zip "${OUTPUT_NAME%.exe}.zip" "${OUTPUT_NAME}" && cd .. | |
| else | |
| cd dist && tar -czf "${OUTPUT_NAME}.tar.gz" "${OUTPUT_NAME}" && cd .. | |
| fi | |
| - name: Upload artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: flac-converter-${{ matrix.goos }}-${{ matrix.goarch }} | |
| path: | | |
| dist/flac-converter-${{ matrix.goos }}-${{ matrix.goarch }}* | |
| release: | |
| name: Create Release | |
| runs-on: ubuntu-latest | |
| needs: [build] | |
| if: github.event_name == 'push' && (github.ref == 'refs/heads/main') | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - name: Download all artifacts | |
| uses: actions/download-artifact@v5 | |
| with: | |
| path: artifacts | |
| - name: Display structure of downloaded files | |
| run: ls -la artifacts/ | |
| - name: Prepare release assets | |
| run: | | |
| mkdir -p release | |
| # Copy archives (tar.gz and zip files) from all artifact directories | |
| find artifacts -type f \( -name "*.tar.gz" -o -name "*.zip" \) -exec cp {} release/ \; | |
| # Copy any standalone binaries that weren't archived | |
| find artifacts -type f -name "flac-converter*" ! -name "*.tar.gz" ! -name "*.zip" -exec cp {} release/ \; | |
| ls -la release/ | |
| - name: Create Release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| tag_name: build-${{ github.sha }} | |
| name: Build ${{ github.sha }} | |
| body: | | |
| Automated build from commit ${{ github.sha }} | |
| Built binaries for: | |
| - Linux (x64, ARM64, x86, ARM) | |
| - Windows (x64, ARM64, x86) | |
| - macOS (x64, ARM64) | |
| files: release/* | |
| draft: false | |
| prerelease: true | |
| make_latest: false | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |