Release #17
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 | |
| on: | |
| push: | |
| tags: | |
| - "v*" | |
| workflow_dispatch: | |
| permissions: | |
| contents: write | |
| jobs: | |
| build-linux: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| goarch: [amd64, arm64] | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - uses: actions/setup-go@v5 | |
| with: | |
| go-version-file: go.mod | |
| - name: Build | |
| env: | |
| GOOS: linux | |
| GOARCH: ${{ matrix.goarch }} | |
| run: | | |
| VERSION="${{ startsWith(github.ref, 'refs/tags/v') && github.ref_name || format('{0}-dev', github.ref_name) }}" | |
| go build -ldflags="-s -w -X github.com/raskrebs/sonar/internal/selfupdate.Version=${VERSION}" -o sonar . | |
| tar czf sonar_linux_${{ matrix.goarch }}.tar.gz sonar | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: sonar_linux_${{ matrix.goarch }} | |
| path: sonar_linux_${{ matrix.goarch }}.tar.gz | |
| build-macos: | |
| runs-on: macos-latest | |
| strategy: | |
| matrix: | |
| goarch: [amd64, arm64] | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - uses: actions/setup-go@v5 | |
| with: | |
| go-version-file: go.mod | |
| - name: Build Go binary | |
| env: | |
| GOOS: darwin | |
| GOARCH: ${{ matrix.goarch }} | |
| run: | | |
| VERSION="${{ startsWith(github.ref, 'refs/tags/v') && github.ref_name || format('{0}-dev', github.ref_name) }}" | |
| go build -ldflags="-s -w -X github.com/raskrebs/sonar/internal/selfupdate.Version=${VERSION}" -o sonar . | |
| codesign -s - sonar | |
| - name: Build Swift tray app | |
| run: | | |
| swiftc -O -o sonar-tray tray/SonarTray.swift \ | |
| -target ${{ matrix.goarch == 'amd64' && 'x86_64' || 'arm64' }}-apple-macos13 | |
| - name: Package | |
| run: | | |
| tar czf sonar_darwin_${{ matrix.goarch }}.tar.gz sonar sonar-tray | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: sonar_darwin_${{ matrix.goarch }} | |
| path: sonar_darwin_${{ matrix.goarch }}.tar.gz | |
| build-windows: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| goarch: [amd64, arm64] | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - uses: actions/setup-go@v5 | |
| with: | |
| go-version-file: go.mod | |
| - name: Build | |
| env: | |
| GOOS: windows | |
| GOARCH: ${{ matrix.goarch }} | |
| run: | | |
| VERSION="${{ startsWith(github.ref, 'refs/tags/v') && github.ref_name || format('{0}-dev', github.ref_name) }}" | |
| go build -ldflags="-s -w -X github.com/raskrebs/sonar/internal/selfupdate.Version=${VERSION}" -o sonar.exe . | |
| zip sonar_windows_${{ matrix.goarch }}.zip sonar.exe | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: sonar_windows_${{ matrix.goarch }} | |
| path: sonar_windows_${{ matrix.goarch }}.zip | |
| release: | |
| if: startsWith(github.ref, 'refs/tags/v') | |
| needs: [build-linux, build-macos, build-windows] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/download-artifact@v4 | |
| with: | |
| merge-multiple: true | |
| - name: Create release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| generate_release_notes: true | |
| files: | | |
| sonar_*.tar.gz | |
| sonar_*.zip |