mirror of
https://github.com/goreleaser/goreleaser.git
synced 2025-01-10 03:47:03 +02:00
bfdec808ab
Signed-off-by: Alex Goodman <alex.goodman@anchore.com> Co-authored-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
126 lines
4.3 KiB
YAML
126 lines
4.3 KiB
YAML
name: build
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- 'main'
|
|
tags:
|
|
- 'v*'
|
|
pull_request:
|
|
|
|
jobs:
|
|
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:
|
|
- uses: actions/checkout@v2
|
|
with:
|
|
fetch-depth: 0
|
|
- uses: arduino/setup-task@v1
|
|
with:
|
|
version: 3.x
|
|
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
|
- uses: docker/setup-qemu-action@v1
|
|
- uses: actions/cache@v2
|
|
with:
|
|
path: |
|
|
./dist/*.deb
|
|
./dist/*.rpm
|
|
./dist/*.apk
|
|
key: ${{ runner.os }}-go-${{ hashFiles('**/*.go') }}-${{ hashFiles('**/go.sum') }}
|
|
- run: task goreleaser:test:${{ matrix.format }}
|
|
goreleaser:
|
|
runs-on: ubuntu-latest
|
|
env:
|
|
DOCKER_CLI_EXPERIMENTAL: "enabled"
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
with:
|
|
fetch-depth: 0
|
|
- uses: arduino/setup-task@v1
|
|
with:
|
|
version: 3.x
|
|
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
|
- uses: docker/setup-qemu-action@v1
|
|
- uses: docker/setup-buildx-action@v1
|
|
- name: setup-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: setup-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
|
|
- uses: actions/setup-go@v2
|
|
with:
|
|
go-version: '1.17'
|
|
- uses: actions/cache@v2
|
|
with:
|
|
path: |
|
|
~/go/pkg/mod
|
|
~/.cache/go-build
|
|
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
|
|
restore-keys: |
|
|
${{ runner.os }}-go-
|
|
- uses: actions/cache@v2
|
|
with:
|
|
path: |
|
|
./dist/*.deb
|
|
./dist/*.rpm
|
|
./dist/*.apk
|
|
key: ${{ runner.os }}-go-${{ hashFiles('**/*.go') }}-${{ hashFiles('**/go.sum') }}
|
|
- uses: sigstore/cosign-installer@v1.4.1
|
|
- name: setup-syft
|
|
run: |
|
|
curl -sSfL https://raw.githubusercontent.com/anchore/syft/main/install.sh | \
|
|
sh -s -- -b /usr/local/bin v0.32.0
|
|
- name: setup-validate-krew-manifest
|
|
# TODO: replace this once https://github.com/kubernetes-sigs/krew/pull/736 is merged
|
|
run: go install github.com/caarlos0/krew/cmd/validate-krew-manifest@fork
|
|
- run: task ci
|
|
- uses: codecov/codecov-action@v2
|
|
with:
|
|
file: ./coverage.txt
|
|
- run: ./goreleaser check
|
|
- run: git diff
|
|
- name: dockerhub-login
|
|
if: startsWith(github.ref, 'refs/tags/v')
|
|
uses: docker/login-action@v1
|
|
with:
|
|
username: ${{ secrets.DOCKER_USERNAME }}
|
|
password: ${{ secrets.DOCKER_PASSWORD }}
|
|
- name: ghcr-login
|
|
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-release
|
|
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
|