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
|
|
|
-
|
2021-01-04 11:48:21 -03:00
|
|
|
name: Set up QEMU
|
|
|
|
uses: docker/setup-qemu-action@v1
|
2021-01-04 12:29:23 -03:00
|
|
|
-
|
|
|
|
name: Set up Docker Buildx
|
|
|
|
uses: docker/setup-buildx-action@v1
|
2020-05-10 23:52:25 +02:00
|
|
|
-
|
|
|
|
name: Set up Snapcraft
|
|
|
|
run: |
|
2021-01-04 13:02:44 -03:00
|
|
|
sudo apt-get update
|
2020-05-10 23:52:25 +02:00
|
|
|
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:
|
2021-02-16 19:51:11 -03:00
|
|
|
go-version: '1.16'
|
2020-05-10 22:08:36 +02:00
|
|
|
-
|
2020-05-10 23:52:25 +02:00
|
|
|
name: Cache Go modules
|
2021-02-08 09:34:14 -03:00
|
|
|
uses: actions/cache@v2.1.4
|
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
|
2021-03-18 09:57:52 -03:00
|
|
|
uses: codecov/codecov-action@v1.3.1
|
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
|
2021-03-02 21:29:31 -03:00
|
|
|
-
|
|
|
|
name: Diff
|
|
|
|
run: git diff
|
2020-05-10 22:08:36 +02:00
|
|
|
-
|
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
|