github.com/yandex/pandora@v0.5.32/.github/workflows/release.yml (about)

     1  name: Release
     2  
     3  on:
     4    release:
     5      types: [ created ]
     6  
     7  permissions:
     8    contents: write
     9    packages: write
    10  
    11  jobs:
    12    releases-matrix:
    13      name: Release Go Binary
    14      strategy:
    15        fail-fast: false
    16        matrix:
    17          os: [ ubuntu-latest, macOS-latest ]
    18          arch: [ amd64, arm64 ]
    19      runs-on: ${{ matrix.os }}
    20      steps:
    21        - name: Checkout code
    22          uses: actions/checkout@v3
    23  
    24        - name: Install Go
    25          uses: actions/setup-go@v3
    26          with:
    27            go-version: 1.21.x
    28            cache: true
    29  
    30        - name: Test
    31          run: go test -race -covermode atomic ./...
    32  
    33        - name: Set GITHUB_ENV
    34          run: |
    35            stripped_tag="${{ github.event.release.tag_name }}"
    36            echo "STRIPPED_TAG=${stripped_tag:1}" >> "$GITHUB_ENV"
    37            if [ "${{ matrix.os }}" == "ubuntu-latest" ]; then
    38              echo "GOOS=linux" >> $GITHUB_ENV
    39            else
    40              echo "GOOS=darwin" >> $GITHUB_ENV
    41            fi
    42  
    43        - name: Build
    44          run: |
    45            export GOARCH=${{ matrix.arch }}
    46            export CGO_ENABLED=0
    47            go build -o pandora_${STRIPPED_TAG}_${GOOS}_${{ matrix.arch }}
    48  
    49        - name: Release
    50          uses: softprops/action-gh-release@v1
    51          with:
    52            files: pandora_${{ env.STRIPPED_TAG }}_${{ env.GOOS }}_${{ matrix.arch }}