2020-05-10 22:08:36 +02:00
|
|
|
name: build
|
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches:
|
2021-11-12 22:23:32 +02:00
|
|
|
- 'main'
|
2020-05-10 22:08:36 +02:00
|
|
|
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
|
2021-10-06 01:05:22 +02:00
|
|
|
-
|
|
|
|
name: Set up Task
|
|
|
|
uses: arduino/setup-task@v1
|
2021-10-13 01:14:15 +02:00
|
|
|
with:
|
|
|
|
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
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
|
2021-09-17 00:18:44 +02:00
|
|
|
-
|
|
|
|
name: Set up Pack CLI for Buildpacks
|
|
|
|
run: |
|
|
|
|
sudo add-apt-repository ppa:cncf-buildpacks/pack-cli
|
|
|
|
sudo apt-get update
|
|
|
|
sudo apt-get --no-install-suggests --no-install-recommends install pack-cli
|
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-08-25 01:49:11 +02:00
|
|
|
go-version: '1.17'
|
2020-05-10 22:08:36 +02:00
|
|
|
-
|
2021-10-06 13:21:38 +02:00
|
|
|
name: Cache Go mod and build
|
2021-05-12 20:23:13 +02:00
|
|
|
uses: actions/cache@v2
|
2020-05-10 23:52:25 +02:00
|
|
|
with:
|
2021-10-06 13:21:38 +02:00
|
|
|
path: |
|
|
|
|
~/go/pkg/mod
|
|
|
|
~/.cache/go-build
|
2020-05-10 23:52:25 +02:00
|
|
|
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
|
|
|
|
restore-keys: |
|
|
|
|
${{ runner.os }}-go-
|
2020-05-10 22:08:36 +02:00
|
|
|
-
|
2021-10-06 01:39:24 +02:00
|
|
|
name: Setup Sigstore
|
2021-11-04 14:26:43 +02:00
|
|
|
uses: sigstore/cosign-installer@v1.3.0
|
2021-11-11 14:37:58 +02:00
|
|
|
- # TODO: replace this once https://github.com/kubernetes-sigs/krew/pull/736 is merged
|
|
|
|
name: Install validate-krew-manifest
|
|
|
|
run: go install github.com/caarlos0/krew/cmd/validate-krew-manifest@fork
|
2020-05-10 22:08:36 +02:00
|
|
|
-
|
2021-10-06 01:39:24 +02:00
|
|
|
name: build and test
|
|
|
|
run: task ci
|
2020-05-10 23:52:25 +02:00
|
|
|
-
|
|
|
|
name: Upload coverage
|
2021-07-29 14:49:25 +02:00
|
|
|
uses: codecov/codecov-action@v2
|
2020-05-10 23:52:25 +02:00
|
|
|
with:
|
|
|
|
file: ./coverage.txt
|
2020-05-10 22:08:36 +02:00
|
|
|
-
|
|
|
|
name: Check
|
2021-10-06 01:39:24 +02:00
|
|
|
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')
|
2021-10-06 04:23:19 +02:00
|
|
|
run: snapcraft login --with <(echo "${{ secrets.SNAPCRAFT_LOGIN }}")
|
2020-05-10 23:52:25 +02:00
|
|
|
-
|
|
|
|
name: GoReleaser
|
2021-11-12 22:23:32 +02:00
|
|
|
if: startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/main'
|
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 }}
|
2021-08-24 16:30:39 +02:00
|
|
|
COSIGN_PWD: ${{ secrets.COSIGN_PWD }}
|
2021-06-21 04:26:17 +02:00
|
|
|
FURY_TOKEN: ${{ secrets.FURY_TOKEN }}
|
2021-09-23 20:33:18 +02:00
|
|
|
DISCORD_WEBHOOK_ID: ${{ secrets.DISCORD_WEBHOOK_ID }}
|
|
|
|
DISCORD_WEBHOOK_TOKEN: ${{ secrets.DISCORD_WEBHOOK_TOKEN }}
|
2021-10-06 04:23:19 +02:00
|
|
|
run: task goreleaser
|