github.com/anycable/anycable-go@v1.5.1/.github/workflows/release-binaries.yml (about)

     1  name: Publish binaries
     2  on:
     3    release:
     4      types: [published]
     5    workflow_dispatch:
     6  
     7  jobs:
     8    upload_binaries:
     9      runs-on: ubuntu-20.04
    10      env:
    11        GO111MODULE: on
    12        CGO_ENABLED: "0"
    13        GOFLAGS: "-mod=vendor"
    14      steps:
    15        - uses: actions/checkout@v2
    16        - name: Install system deps
    17          run: |
    18            sudo apt-get update
    19            sudo apt-get install bison
    20        - uses: actions/cache@v1
    21          with:
    22            path: vendor
    23            key: vendor-${{ hashFiles('**/go.sum') }}
    24            restore-keys: |
    25              vendor-
    26        - run: go mod vendor
    27        - uses: ruby/setup-ruby@v1
    28          with:
    29            # Use <3.0 since go-mruby's Rakefile has some problems with keyword arguments compatibility
    30            ruby-version: 2.7
    31            bundler-cache: true
    32        - name: Build mruby
    33          run: bash -c '(cd vendor/github.com/mitchellh/go-mruby && MRUBY_CONFIG=../../../../../../etc/build_config.rb make libmruby.a)'
    34        - uses: actions/setup-go@v4
    35          with:
    36            go-version-file: go.mod
    37        - name: Set VERSION (if any)
    38          if: ${{ contains(github.ref, 'refs/tags/v') }}
    39          id: version
    40          run: |
    41            echo ::set-output name=VERSION::${GITHUB_REF#refs/tags/v}
    42        - name: Build binaries
    43          run: |
    44            env GOOS=windows GOARCH=amd64 go build -ldflags "-s -w -X github.com/anycable/anycable-go/version.version=${{ steps.version.outputs.VERSION }} -X github.com/anycable/anycable-go/version.sha=$(echo "$GITHUB_SHA" | cut -c -7)" -a -o dist/anycable-go-win-amd64.exe cmd/anycable-go/main.go
    45            env GOOS=freebsd GOARCH=arm   go build -ldflags "-s -w -X github.com/anycable/anycable-go/version.version=${{ steps.version.outputs.VERSION }} -X github.com/anycable/anycable-go/version.sha=$(echo "$GITHUB_SHA" | cut -c -7)" -a -o dist/anycable-go-freebsd-arm cmd/anycable-go/main.go
    46            env GOOS=freebsd GOARCH=amd64 go build -ldflags "-s -w -X github.com/anycable/anycable-go/version.version=${{ steps.version.outputs.VERSION }} -X github.com/anycable/anycable-go/version.sha=$(echo "$GITHUB_SHA" | cut -c -7)" -a -o dist/anycable-go-freebsd-amd64 cmd/anycable-go/main.go
    47            env GOOS=linux GOARCH=arm64   go build -ldflags "-s -w -X github.com/anycable/anycable-go/version.version=${{ steps.version.outputs.VERSION }} -X github.com/anycable/anycable-go/version.sha=$(echo "$GITHUB_SHA" | cut -c -7)" -a -o dist/anycable-go-linux-arm64 cmd/anycable-go/main.go
    48            env GOOS=linux GOARCH=amd64   go build -ldflags "-s -w -X github.com/anycable/anycable-go/version.version=${{ steps.version.outputs.VERSION }} -X github.com/anycable/anycable-go/version.sha=$(echo "$GITHUB_SHA" | cut -c -7)" -a -o dist/anycable-go-linux-amd64 cmd/anycable-go/main.go
    49            dist/anycable-go-linux-amd64 -v
    50        - name: Build binary with MRuby
    51          env:
    52            CGO_ENABLED: "1"
    53          run: |
    54            env GOOS=linux GOARCH=amd64 go build -tags mrb -ldflags "-s -w -X github.com/anycable/anycable-go/version.version=${{ steps.version.outputs.VERSION }} -X github.com/anycable/anycable-go/version.sha=$(echo "$GITHUB_SHA" | cut -c -7)" -a -o dist/anycable-go-mrb-linux-amd64 cmd/anycable-go/main.go
    55            dist/anycable-go-mrb-linux-amd64 -v
    56        - uses: xresloader/upload-to-github-release@v1
    57          env:
    58            GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
    59          with:
    60            file: "dist/anycable-go-*"
    61            tags: true
    62  
    63    upload_macos_binaries:
    64      needs: [upload_binaries]
    65      runs-on: macos-latest
    66      env:
    67        GO111MODULE: on
    68        CGO_ENABLED: "0"
    69        GOFLAGS: "-mod=vendor"
    70      steps:
    71      - uses: actions/checkout@v2
    72      - name: Install system deps
    73        run: |
    74          brew install bison
    75      - uses: actions/cache@v1
    76        with:
    77          path: vendor
    78          key: vendor-${{ hashFiles('**/go.sum') }}
    79          restore-keys: |
    80            vendor-
    81      - run: go mod vendor
    82      - uses: ruby/setup-ruby@v1
    83        with:
    84          # Use <3.0 since go-mruby's Rakefile has some problems with keyword arguments compatibility
    85          ruby-version: 2.7
    86          bundler-cache: true
    87      - name: Build mruby
    88        run: bash -c '(cd vendor/github.com/mitchellh/go-mruby && MRUBY_CONFIG=../../../../../../etc/build_config.rb make libmruby.a)'
    89      - uses: actions/setup-go@v4
    90        with:
    91          go-version-file: go.mod
    92      - name: Set VERSION (if any)
    93        if: ${{ contains(github.ref, 'refs/tags/v') }}
    94        id: version
    95        run: |
    96          echo ::set-output name=VERSION::${GITHUB_REF#refs/tags/v}
    97      - name: Build binaries for MacOS
    98        run: |
    99          env GOOS=darwin GOARCH=amd64 go build -ldflags "-s -w -X github.com/anycable/anycable-go/version.version=${{ steps.version.outputs.VERSION }} -X github.com/anycable/anycable-go/version.sha=$(echo "$GITHUB_SHA" | cut -c -7)" -a -o dist/anycable-go-darwin-amd64 cmd/anycable-go/main.go
   100          env GOOS=darwin GOARCH=arm64 go build -ldflags "-s -w -X github.com/anycable/anycable-go/version.version=${{ steps.version.outputs.VERSION }} -X github.com/anycable/anycable-go/version.sha=$(echo "$GITHUB_SHA" | cut -c -7)" -a -o dist/anycable-go-darwin-arm64 cmd/anycable-go/main.go
   101      - name: Build binaries with MRuby for MacOS
   102        env:
   103          CGO_ENABLED: "1"
   104        run: |
   105          env GOOS=darwin GOARCH=amd64 go build -tags mrb -ldflags "-s -w -X github.com/anycable/anycable-go/version.version=${{ steps.version.outputs.VERSION }} -X github.com/anycable/anycable-go/version.sha=$(echo "$GITHUB_SHA" | cut -c -7)" -a -o dist/anycable-go-mrb-darwin-amd64 cmd/anycable-go/main.go
   106          dist/anycable-go-mrb-darwin-amd64 -v
   107      - uses: xresloader/upload-to-github-release@v1
   108        env:
   109          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
   110        with:
   111          file: "dist/anycable-go-*"
   112          tags: true