2020-05-10 22:08:36 +02:00
|
|
|
name: build
|
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches:
|
|
|
|
- 'master'
|
|
|
|
tags:
|
|
|
|
- 'v*'
|
|
|
|
pull_request:
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
goreleaser:
|
|
|
|
runs-on: ubuntu-latest
|
2020-11-28 16:26:37 -03:00
|
|
|
env:
|
|
|
|
DOCKER_CLI_EXPERIMENTAL: "enabled"
|
2020-05-10 22:08:36 +02:00
|
|
|
steps:
|
2020-05-10 23:52:25 +02:00
|
|
|
-
|
|
|
|
name: Checkout
|
2020-11-04 13:41:35 -03:00
|
|
|
uses: actions/checkout@v2.3.4
|
2020-06-16 09:37:11 -03:00
|
|
|
with:
|
|
|
|
fetch-depth: 0
|
2020-11-28 16:54:34 -03:00
|
|
|
-
|
|
|
|
name: Allow arm64 builds
|
|
|
|
run: sudo docker run --privileged linuxkit/binfmt:v0.7
|
2020-12-11 19:01:01 -03:00
|
|
|
- name: apt update
|
|
|
|
run: sudo apt-get update
|
2020-05-10 23:52:25 +02:00
|
|
|
-
|
|
|
|
name: Set up Snapcraft
|
|
|
|
run: |
|
|
|
|
sudo apt-get -yq --no-install-suggests --no-install-recommends install snapcraft
|
2020-05-10 22:08:36 +02:00
|
|
|
-
|
|
|
|
name: Set up Go
|
|
|
|
uses: actions/setup-go@v2
|
|
|
|
with:
|
2020-08-16 11:29:44 -03:00
|
|
|
go-version: 1.15
|
2020-05-10 22:08:36 +02:00
|
|
|
-
|
2020-05-10 23:52:25 +02:00
|
|
|
name: Cache Go modules
|
2020-06-10 21:28:51 +00:00
|
|
|
uses: actions/cache@v2
|
2020-05-10 23:52:25 +02:00
|
|
|
with:
|
|
|
|
path: ~/go/pkg/mod
|
|
|
|
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
|
|
|
|
restore-keys: |
|
|
|
|
${{ runner.os }}-go-
|
2020-05-10 22:08:36 +02:00
|
|
|
-
|
|
|
|
name: Make Setup
|
|
|
|
run: |
|
|
|
|
make setup
|
|
|
|
-
|
|
|
|
name: Make CI
|
|
|
|
run: |
|
|
|
|
make ci
|
2020-05-10 23:52:25 +02:00
|
|
|
-
|
|
|
|
name: Upload coverage
|
2020-12-18 08:27:58 -03:00
|
|
|
uses: codecov/codecov-action@v1.1.0
|
2020-05-10 23:52:25 +02:00
|
|
|
with:
|
|
|
|
token: ${{ secrets.CODECOV_TOKEN }}
|
|
|
|
file: ./coverage.txt
|
2020-05-10 22:08:36 +02:00
|
|
|
-
|
|
|
|
name: Check
|
|
|
|
run: |
|
|
|
|
./goreleaser check
|
|
|
|
-
|
2020-05-10 23:52:25 +02:00
|
|
|
name: Docker Login
|
|
|
|
if: success() && startsWith(github.ref, 'refs/tags/v')
|
|
|
|
env:
|
|
|
|
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
|
|
|
|
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
|
2020-09-06 10:16:53 -03:00
|
|
|
GITHUB_TOKEN: ${{ secrets.GH_PAT }}
|
2020-05-10 23:52:25 +02:00
|
|
|
run: |
|
|
|
|
echo "${DOCKER_PASSWORD}" | docker login --username "${DOCKER_USERNAME}" --password-stdin
|
2020-09-06 10:16:53 -03:00
|
|
|
echo "${GITHUB_TOKEN}" | docker login ghcr.io --username $GITHUB_ACTOR --password-stdin
|
2020-05-10 23:52:25 +02:00
|
|
|
-
|
|
|
|
name: Snapcraft Login
|
|
|
|
if: success() && startsWith(github.ref, 'refs/tags/v')
|
|
|
|
env:
|
|
|
|
SNAPCRAFT_LOGIN: ${{ secrets.SNAPCRAFT_LOGIN }}
|
|
|
|
run: |
|
|
|
|
snapcraft login --with <(echo "$SNAPCRAFT_LOGIN")
|
|
|
|
-
|
|
|
|
name: GoReleaser
|
2020-12-22 15:04:51 +01:00
|
|
|
if: success()
|
2020-05-13 17:23:45 -03:00
|
|
|
env:
|
|
|
|
GITHUB_TOKEN: ${{ secrets.GH_PAT }}
|
2020-05-10 23:52:25 +02:00
|
|
|
run: |
|
2020-12-22 15:04:51 +01:00
|
|
|
if [[ $GITHUB_REF == refs/tags/v* ]]; then
|
|
|
|
./goreleaser
|
|
|
|
elif [[ $GITHUB_REF == refs/heads/master ]]; then
|
|
|
|
./goreleaser --snapshot
|
|
|
|
fi
|
2020-05-10 23:52:25 +02:00
|
|
|
-
|
|
|
|
name: Clear
|
|
|
|
if: always() && startsWith(github.ref, 'refs/tags/v')
|
2020-05-10 22:08:36 +02:00
|
|
|
run: |
|
2020-05-10 23:52:25 +02:00
|
|
|
rm -f ${HOME}/.docker/config.json
|