github.com/vicanso/pike@v1.0.1-0.20210630235453-9099e041f6ec/.github/workflows/build.yml (about)

     1  name: build on tag
     2  
     3  on:
     4    push:
     5      tags:
     6        - 'v*.*.*'
     7  
     8  jobs:
     9    docker:
    10      runs-on: ubuntu-latest
    11      name: Build
    12      steps:
    13      - name: Check out code into the Go module directory
    14        uses: actions/checkout@v2
    15      - name: Set output
    16        id: vars
    17        run: echo ::set-output name=tag::${GITHUB_REF#refs/*/}
    18      - name: Set up QEMU
    19        uses: docker/setup-qemu-action@v1
    20      - name: Set up Docker Buildx
    21        uses: docker/setup-buildx-action@v1
    22      - name: Login to Docker Hub
    23        uses: docker/login-action@v1
    24        with:
    25          username: ${{ secrets.DOCKER_HUB_USERNAME }}
    26          password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
    27      - name: Build and push
    28        id: docker_build
    29        uses: docker/build-push-action@v2
    30        with:
    31          push: true
    32          tags: ${{ secrets.DOCKER_HUB_USERNAME }}/pike:${{ steps.vars.outputs.tag }}
    33          build-args: GITHUB_SHA=${ GITHUB_SHA },VERSION=${{ steps.vars.outputs.tag }}
    34      - name: Image digest
    35        run: echo ${{ steps.docker_build.outputs.digest }}
    36    goreleaser:
    37      runs-on: ubuntu-latest
    38      steps:
    39        -
    40          name: Checkout
    41          uses: actions/checkout@v2
    42          with:
    43            fetch-depth: 0
    44        -
    45          name: Set up Go
    46          uses: actions/setup-go@v2
    47          with:
    48            go-version: 1.16
    49        -
    50          name: Run GoReleaser
    51          uses: goreleaser/goreleaser-action@v2
    52          with:
    53            version: latest
    54            args: release --rm-dist
    55          env:
    56            GITHUB_TOKEN: ${{ secrets.GH_PAT }}