v1.0.0 #1
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: Build and Release | |
| on: | |
| release: | |
| types: [published] | |
| jobs: | |
| build: | |
| name: Build Release Assets | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| os: [linux, windows, darwin] | |
| arch: [amd64, arm64, 386] | |
| binaryname: [ComputeSIDFromServiceName] | |
| # Exclude incompatible couple of GOOS and GOARCH values | |
| exclude: | |
| - os: darwin | |
| arch: 386 | |
| env: | |
| GO111MODULE: 'on' | |
| CGO_ENABLED: '0' | |
| steps: | |
| - name: Checkout Repository | |
| uses: actions/checkout@v3 | |
| - name: Set up Go | |
| uses: actions/setup-go@v4 | |
| with: | |
| go-version: '1.24.0' | |
| - name: Build Binary | |
| env: | |
| GOOS: ${{ matrix.os }} | |
| GOARCH: ${{ matrix.arch }} | |
| run: | | |
| mkdir -p bin | |
| OUTPUT_PATH="../build/${{ matrix.binaryname }}-${{ matrix.os }}-${{ matrix.arch }}" | |
| # Build the binary | |
| go build -ldflags="-s -w" -o $OUTPUT_PATH${{ matrix.os == 'windows' && '.exe' || '' }} | |
| - name: Prepare Release Assets | |
| if: ${{ success() }} | |
| run: | | |
| mkdir -p ./release/ | |
| cp ./build/${{ matrix.binaryname }}-* ./release/ | |
| - name: Upload the Release binaries | |
| uses: svenstaro/upload-release-action@v2 | |
| with: | |
| repo_token: ${{ secrets.GITHUB_TOKEN }} | |
| tag: ${{ github.ref }} | |
| file: ./release/${{ matrix.binaryname }}-* | |
| file_glob: true |