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 21:26:37 +02: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
|
2021-05-12 20:23:13 +02:00
|
|
|
uses: actions/checkout@v2
|
2020-06-16 14:37:11 +02:00
|
|
|
with:
|
|
|
|
fetch-depth: 0
|
2020-11-28 21:54:34 +02:00
|
|
|
-
|
2021-01-04 16:48:21 +02:00
|
|
|
name: Set up QEMU
|
2021-05-12 20:23:13 +02:00
|
|
|
uses: docker/setup-qemu-action@v1
|
2021-01-04 17:29:23 +02:00
|
|
|
-
|
|
|
|
name: Set up Docker Buildx
|
2021-05-12 20:23:13 +02:00
|
|
|
uses: docker/setup-buildx-action@v1
|
2020-05-10 23:52:25 +02:00
|
|
|
-
|
|
|
|
name: Set up Snapcraft
|
2021-03-19 13:48:37 +02:00
|
|
|
# FIXME: the mkdirs are a hack for https://github.com/goreleaser/goreleaser/issues/1715
|
2020-05-10 23:52:25 +02:00
|
|
|
run: |
|
2021-01-04 18:02:44 +02: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
|
2021-03-19 13:48:37 +02:00
|
|
|
mkdir -p $HOME/.cache/snapcraft/download
|
|
|
|
mkdir -p $HOME/.cache/snapcraft/stage-packages
|
2020-05-10 22:08:36 +02:00
|
|
|
-
|
|
|
|
name: Set up Go
|
|
|
|
uses: actions/setup-go@v2
|
|
|
|
with:
|
2021-02-17 00:51:11 +02: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-05-12 20:23:13 +02: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
|
2021-05-12 20:23:13 +02:00
|
|
|
uses: codecov/codecov-action@v1
|
2020-05-10 23:52:25 +02:00
|
|
|
with:
|
|
|
|
file: ./coverage.txt
|
2020-05-10 22:08:36 +02:00
|
|
|
-
|
|
|
|
name: Check
|
|
|
|
run: |
|
|
|
|
./goreleaser check
|
2021-03-03 02:29:31 +02:00
|
|
|
-
|
|
|
|
name: Diff
|
|
|
|
run: git diff
|
2020-05-10 22:08:36 +02:00
|
|
|
-
|
2021-05-21 04:07:48 +02:00
|
|
|
name: Login to Docker Hub
|
|
|
|
if: startsWith(github.ref, 'refs/tags/v')
|
|
|
|
uses: docker/login-action@v1
|
|
|
|
with:
|
|
|
|
username: ${{ secrets.DOCKER_USERNAME }}
|
|
|
|
password: ${{ secrets.DOCKER_PASSWORD }}
|
|
|
|
-
|
|
|
|
name: Login to GitHub Container Registry
|
|
|
|
if: startsWith(github.ref, 'refs/tags/v')
|
|
|
|
uses: docker/login-action@v1
|
|
|
|
with:
|
|
|
|
registry: ghcr.io
|
|
|
|
username: ${{ github.repository_owner }}
|
|
|
|
password: ${{ secrets.GITHUB_TOKEN }}
|
2020-05-10 23:52:25 +02:00
|
|
|
-
|
|
|
|
name: Snapcraft Login
|
2021-05-21 04:07:48 +02:00
|
|
|
if: startsWith(github.ref, 'refs/tags/v')
|
2020-05-10 23:52:25 +02:00
|
|
|
run: |
|
2021-05-21 04:07:48 +02:00
|
|
|
snapcraft login --with <(echo "${{ secrets.SNAPCRAFT_LOGIN }}")
|
2020-05-10 23:52:25 +02:00
|
|
|
-
|
|
|
|
name: GoReleaser
|
2020-05-13 22:23:45 +02:00
|
|
|
env:
|
|
|
|
GITHUB_TOKEN: ${{ secrets.GH_PAT }}
|
2021-05-25 06:09:58 +02:00
|
|
|
TWITTER_CONSUMER_KEY: ${{ secrets.TWITTER_CONSUMER_KEY }}
|
|
|
|
TWITTER_CONSUMER_SECRET: ${{ secrets.TWITTER_CONSUMER_SECRET }}
|
|
|
|
TWITTER_ACCESS_TOKEN: ${{ secrets.TWITTER_ACCESS_TOKEN }}
|
|
|
|
TWITTER_ACCESS_TOKEN_SECRET: ${{ secrets.TWITTER_ACCESS_TOKEN_SECRET }}
|
2020-05-10 23:52:25 +02:00
|
|
|
run: |
|
2020-12-22 16:04:51 +02:00
|
|
|
if [[ $GITHUB_REF == refs/tags/v* ]]; then
|
|
|
|
./goreleaser
|
|
|
|
elif [[ $GITHUB_REF == refs/heads/master ]]; then
|
|
|
|
./goreleaser --snapshot
|
|
|
|
fi
|