github.com/googleapis/api-linter@v1.65.2/.github/workflows/release.yaml (about)

     1  ---
     2  name: release
     3  on:
     4    release:
     5      types:
     6        - created
     7  
     8  env:
     9    # e.g. v1.0.0
    10    TAG_NAME: ${{ github.event.release.tag_name }}
    11  
    12  jobs:
    13    build:
    14      runs-on: ubuntu-latest
    15      strategy:
    16        matrix:
    17          osarch:
    18            - os: linux
    19              arch: amd64
    20            - os: linux
    21              arch: arm
    22            - os: darwin
    23              arch: amd64
    24            - os: darwin
    25              arch: arm64
    26            - os: windows
    27              arch: amd64
    28      steps:
    29        - uses: actions/checkout@v4
    30        - uses: actions/setup-go@v5
    31          with:
    32            go-version-file: 'go.mod'
    33        # The API linter does not use these,  but we need them to build the
    34        # binaries.
    35        #
    36        # gox is a cross-compiler binary and needs to be install with `go install`.
    37        #
    38        # Mousetrap is a build dependency installed individually because it is
    39        # only needed for the Windows build. Since we are building on Linux, it is
    40        # not installed automatically as a dependency.
    41        - name: Install the cross-platform build tool.
    42          run: |
    43            go install github.com/mitchellh/gox@latest
    44            go get github.com/inconshreveable/mousetrap
    45        - name: Build for the ${{ matrix.osarch.os }}/${{ matrix.osarch.arch }} platform.
    46          run: |
    47            CGO_ENABLED=0  gox -osarch ${{ matrix.osarch.os }}/${{ matrix.osarch.arch }} -output api-linter ./... && \
    48            tar cvfz api-linter.tar.gz api-linter*
    49        - name: Set raw version
    50          id: raw_tag
    51          # Strips the 'v' from the actual semver version.
    52          run: echo "raw_version=${TAG_NAME#v}" >> $GITHUB_OUTPUT
    53          shell: bash
    54        - name: Upload the ${{ matrix.osarch.os }}/${{ matrix.osarch.arch }} release.
    55          uses: actions/upload-release-asset@v1
    56          env:
    57            GITHUB_TOKEN: ${{ github.token }}
    58          with:
    59            upload_url: ${{ github.event.release.upload_url }}
    60            asset_path: ./api-linter.tar.gz
    61            asset_name: api-linter-${{ steps.raw_tag.outputs.raw_version }}-${{ matrix.osarch.os }}-${{ matrix.osarch.arch }}.tar.gz
    62            asset_content_type: application/tar+gzip