alibaba/kt-connect

View on GitHub
.github/workflows/release.yml

Summary

Maintainability
Test Coverage
name: release

on:
  push:
    tags:
    - 'v*.*.*'
jobs:
  release-cli:
    name: Release packages
    runs-on: ubuntu-latest
    steps:

    - name: Set up Go 1.18
      uses: actions/setup-go@v1
      with:
        go-version: 1.18
      id: go

    - name: Check out code into the Go module directory
      uses: actions/checkout@v2

    - name: Get go mod cache
      uses: actions/cache@v1
      with:
        path: ~/go/pkg/mod
        key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
        restore-keys: |
          ${{ runner.os }}-go-

    - name: Get dependencies
      run: |
        go get -v -t -d ./...
        if [ -f Gopkg.toml ]; then
            curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh
            dep ensure
        fi

    - name: Docker login
      uses: azure/docker-login@v1
      with:
        login-server: registry.cn-hangzhou.aliyuncs.com
        username: ${{ secrets.ALIYUN_DOCKER_USERNAME }}
        password: ${{ secrets.ALIYUN_DOCKER_PASSWORD }}

    - name: Run GoReleaser
      uses: goreleaser/goreleaser-action@v1
      with:
        version: latest
        args: release --rm-dist
      env:
        GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

    - name: Update Homebrew formula
      uses: dawidd6/action-homebrew-bump-formula@v3
      with:
        token: ${{secrets.GITHUB_TOKEN}}
        formula: kt-connect
        tag: ${{github.ref}}
        revision: ${{github.sha}}
        force: false