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:
|
|
|
|
|
2021-12-16 18:43:11 +02:00
|
|
|
permissions:
|
|
|
|
contents: write
|
|
|
|
id-token: write
|
|
|
|
packages: write
|
|
|
|
|
2020-05-10 22:08:36 +02:00
|
|
|
jobs:
|
2021-11-14 16:54:31 +02:00
|
|
|
goreleaser-check-pkgs:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
env:
|
|
|
|
DOCKER_CLI_EXPERIMENTAL: "enabled"
|
|
|
|
needs:
|
|
|
|
- goreleaser
|
|
|
|
if: github.ref == 'refs/heads/main'
|
|
|
|
strategy:
|
|
|
|
matrix:
|
|
|
|
format: [ deb, rpm, apk ]
|
|
|
|
steps:
|
2022-03-17 03:29:18 +02:00
|
|
|
- uses: actions/checkout@b0e28b5ac45a892f91e7d036f8200cf5ed489415 # v3
|
2021-11-14 16:54:31 +02:00
|
|
|
with:
|
|
|
|
fetch-depth: 0
|
2022-03-28 14:36:15 +02:00
|
|
|
- uses: arduino/setup-task@ca745e18916de727f841ec824ac20a615f1cddea # v1
|
2021-11-14 16:54:31 +02:00
|
|
|
with:
|
|
|
|
version: 3.x
|
|
|
|
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
2022-05-06 20:58:34 +02:00
|
|
|
- uses: docker/setup-qemu-action@8b122486cedac8393e77aa9734c3528886e4a1a8 # v1
|
2022-03-17 03:29:18 +02:00
|
|
|
- uses: actions/cache@661fd3eb7f2f20d8c7c84bc2b0509efd7a826628 # v2
|
2021-11-14 16:54:31 +02:00
|
|
|
with:
|
2021-11-14 17:27:43 +02:00
|
|
|
path: |
|
|
|
|
./dist/*.deb
|
|
|
|
./dist/*.rpm
|
|
|
|
./dist/*.apk
|
2021-11-14 16:54:31 +02:00
|
|
|
key: ${{ runner.os }}-go-${{ hashFiles('**/*.go') }}-${{ hashFiles('**/go.sum') }}
|
|
|
|
- run: task goreleaser:test:${{ matrix.format }}
|
2020-05-10 22:08:36 +02:00
|
|
|
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:
|
2022-03-17 03:29:18 +02:00
|
|
|
- uses: actions/checkout@b0e28b5ac45a892f91e7d036f8200cf5ed489415 # v3
|
2020-06-16 14:37:11 +02:00
|
|
|
with:
|
|
|
|
fetch-depth: 0
|
2022-03-28 14:36:15 +02:00
|
|
|
- uses: arduino/setup-task@ca745e18916de727f841ec824ac20a615f1cddea # v1
|
2021-10-13 01:14:15 +02:00
|
|
|
with:
|
2021-11-14 16:54:31 +02:00
|
|
|
version: 3.x
|
2021-10-13 01:14:15 +02:00
|
|
|
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
2022-05-06 20:58:34 +02:00
|
|
|
- uses: docker/setup-qemu-action@8b122486cedac8393e77aa9734c3528886e4a1a8 # v1
|
2022-05-06 19:37:18 +02:00
|
|
|
- uses: docker/setup-buildx-action@dc7b9719a96d48369863986a06765841d7ea23f6 # v1
|
2021-11-14 16:54:31 +02:00
|
|
|
- name: setup-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
|
2022-07-12 14:56:52 +02:00
|
|
|
- uses: actions/setup-go@84cbf8094393cdc5fe1fe1671ff2647332956b1a # v3
|
2020-05-10 22:08:36 +02:00
|
|
|
with:
|
2022-03-17 02:51:48 +02:00
|
|
|
go-version: '1.18'
|
2022-03-17 03:29:18 +02:00
|
|
|
- uses: actions/cache@661fd3eb7f2f20d8c7c84bc2b0509efd7a826628 # 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-
|
2022-03-17 03:29:18 +02:00
|
|
|
- uses: actions/cache@661fd3eb7f2f20d8c7c84bc2b0509efd7a826628 # v2
|
2021-11-14 16:54:31 +02:00
|
|
|
with:
|
2021-11-14 17:27:43 +02:00
|
|
|
path: |
|
|
|
|
./dist/*.deb
|
|
|
|
./dist/*.rpm
|
|
|
|
./dist/*.apk
|
2021-11-14 16:54:31 +02:00
|
|
|
key: ${{ runner.os }}-go-${{ hashFiles('**/*.go') }}-${{ hashFiles('**/go.sum') }}
|
2022-07-26 14:04:54 +02:00
|
|
|
- uses: sigstore/cosign-installer@v2.5.0
|
2022-06-13 19:28:00 +02:00
|
|
|
- uses: anchore/sbom-action/download-syft@v0.11.0
|
2021-11-14 16:54:31 +02:00
|
|
|
- name: setup-validate-krew-manifest
|
2022-04-14 04:00:29 +02:00
|
|
|
run: go install sigs.k8s.io/krew/cmd/validate-krew-manifest@latest
|
2022-06-12 04:25:04 +02:00
|
|
|
- name: setup-tparse
|
|
|
|
run: go install github.com/mfridman/tparse@latest
|
|
|
|
- name: setup
|
|
|
|
run: |
|
|
|
|
task setup
|
|
|
|
task build
|
|
|
|
- name: test
|
2022-06-24 14:33:34 +02:00
|
|
|
run: ./scripts/test.sh
|
2022-04-22 14:36:20 +02:00
|
|
|
- uses: codecov/codecov-action@81cd2dc8148241f03f5839d295e000b8f761e378 # v3
|
2020-05-10 23:52:25 +02:00
|
|
|
with:
|
|
|
|
file: ./coverage.txt
|
2021-11-14 16:54:31 +02:00
|
|
|
- run: ./goreleaser check
|
|
|
|
- run: git diff
|
|
|
|
- name: dockerhub-login
|
2021-05-21 04:07:48 +02:00
|
|
|
if: startsWith(github.ref, 'refs/tags/v')
|
2022-05-06 20:56:44 +02:00
|
|
|
uses: docker/login-action@49ed152c8eca782a232dede0303416e8f356c37b # v1
|
2021-05-21 04:07:48 +02:00
|
|
|
with:
|
|
|
|
username: ${{ secrets.DOCKER_USERNAME }}
|
|
|
|
password: ${{ secrets.DOCKER_PASSWORD }}
|
2021-11-14 16:54:31 +02:00
|
|
|
- name: ghcr-login
|
2021-05-21 04:07:48 +02:00
|
|
|
if: startsWith(github.ref, 'refs/tags/v')
|
2022-05-06 20:56:44 +02:00
|
|
|
uses: docker/login-action@49ed152c8eca782a232dede0303416e8f356c37b # v1
|
2021-05-21 04:07:48 +02:00
|
|
|
with:
|
|
|
|
registry: ghcr.io
|
|
|
|
username: ${{ github.repository_owner }}
|
|
|
|
password: ${{ secrets.GITHUB_TOKEN }}
|
2021-11-14 16:54:31 +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 }}")
|
2021-11-14 16:54:31 +02:00
|
|
|
- name: goreleaser-release
|
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 }}
|
2022-01-27 03:14:52 +02:00
|
|
|
AUR_KEY: ${{ secrets.AUR_KEY }}
|
2021-10-06 04:23:19 +02:00
|
|
|
run: task goreleaser
|