1
0
mirror of https://github.com/goreleaser/goreleaser.git synced 2025-01-10 03:47:03 +02:00
goreleaser/.github/workflows/build.yml

115 lines
3.6 KiB
YAML
Raw Normal View History

name: build
on:
push:
branches:
2021-11-12 22:23:32 +02:00
- 'main'
tags:
- 'v*'
pull_request:
jobs:
goreleaser:
runs-on: ubuntu-latest
env:
DOCKER_CLI_EXPERIMENTAL: "enabled"
steps:
-
name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
-
name: Set up Task
uses: arduino/setup-task@v1
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
-
name: Set up QEMU
uses: docker/setup-qemu-action@v1
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
-
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
-
name: Set up Snapcraft
# FIXME: the mkdirs are a hack for https://github.com/goreleaser/goreleaser/issues/1715
run: |
sudo apt-get update
sudo apt-get -yq --no-install-suggests --no-install-recommends install snapcraft
mkdir -p $HOME/.cache/snapcraft/download
mkdir -p $HOME/.cache/snapcraft/stage-packages
-
name: Set up Go
uses: actions/setup-go@v2
with:
go-version: '1.17'
-
name: Cache Go mod and build
uses: actions/cache@v2
with:
path: |
~/go/pkg/mod
~/.cache/go-build
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
-
name: Setup Sigstore
uses: sigstore/cosign-installer@v1.3.0
- # 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
-
name: build and test
run: task ci
-
name: Upload coverage
2021-07-29 14:49:25 +02:00
uses: codecov/codecov-action@v2
with:
file: ./coverage.txt
-
name: Check
run: ./goreleaser check
-
name: Diff
run: git diff
-
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 }}
-
name: Snapcraft Login
if: startsWith(github.ref, 'refs/tags/v')
run: snapcraft login --with <(echo "${{ secrets.SNAPCRAFT_LOGIN }}")
-
name: GoReleaser
2021-11-12 22:23:32 +02:00
if: startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/main'
env:
GITHUB_TOKEN: ${{ secrets.GH_PAT }}
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 }}
COSIGN_PWD: ${{ secrets.COSIGN_PWD }}
FURY_TOKEN: ${{ secrets.FURY_TOKEN }}
DISCORD_WEBHOOK_ID: ${{ secrets.DISCORD_WEBHOOK_ID }}
DISCORD_WEBHOOK_TOKEN: ${{ secrets.DISCORD_WEBHOOK_TOKEN }}
run: task goreleaser