1
1
Fork 0
mirror of https://github.com/goreleaser/nfpm synced 2024-06-10 10:26:15 +02:00
nfpm/.github/workflows/build.yml
Carlos Alexandro Becker 0246c68390
fix(ci): go mod tidy (#308)
Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com>
2021-03-02 21:29:17 -03:00

91 lines
2.4 KiB
YAML

name: build
on:
push:
branches:
- 'master'
tags:
- 'v*'
pull_request:
jobs:
goreleaser:
strategy:
matrix:
go-version: [ ~1.16 ]
os: [ ubuntu-latest, macos-latest, windows-latest ]
runs-on: ${{ matrix.os }}
env:
DOCKER_CLI_EXPERIMENTAL: "enabled"
steps:
-
name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
-
name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.16
-
name: Cache Go modules
uses: actions/cache@v1
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
-
name: Set up QEMU
uses: docker/setup-qemu-action@v1
if: matrix.os == 'ubuntu-latest'
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
if: matrix.os == 'ubuntu-latest'
-
name: Setup
run: make setup
-
name: Test
run: make build test
-
name: Acceptance tests
run: make acceptance
if: matrix.os == 'ubuntu-latest'
-
name: Diff
run: git diff
-
name: Upload coverage
uses: codecov/codecov-action@v1
if: matrix.os == 'ubuntu-latest'
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: ./coverage.txt
-
name: Docker Login
if: success() && startsWith(github.ref, 'refs/tags/') && matrix.os == 'ubuntu-latest'
env:
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
GITHUB_TOKEN: ${{ secrets.GH_PAT }}
run: |
echo "${DOCKER_PASSWORD}" | docker login --username "${DOCKER_USERNAME}" --password-stdin
echo "${GITHUB_TOKEN}" | docker login ghcr.io --username $GITHUB_ACTOR --password-stdin
-
name: Run GoReleaser
uses: goreleaser/goreleaser-action@v2
if: success() && startsWith(github.ref, 'refs/tags/') && matrix.os == 'ubuntu-latest'
with:
version: latest
args: release --rm-dist
env:
GITHUB_TOKEN: ${{ secrets.GH_PAT }}
-
name: Clear
if: matrix.os == 'ubuntu-latest'
run: |
rm -f ${HOME}/.docker/config.json