unpoller_unpoller/.github/workflows/release.yml

75 lines
2.4 KiB
YAML

name: Release
on:
push:
# run only against tags
tags:
- '*'
permissions:
contents: write
packages: write
# issues: write
jobs:
release:
runs-on: ubuntu-latest
env:
DOCKER_CLI_EXPERIMENTAL: "enabled"
DOCKER_REGISTRY: "ghcr.io"
DOCKER_IMAGE_NAME: "unpoller/unpoller"
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- run: git fetch --force --tags
- name: Install RPM tooling
run: sudo apt-get install -y rpm
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v2
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Import GPG key
id: import_gpg
uses: crazy-max/ghaction-import-gpg@v5
with:
gpg_private_key: ${{ secrets.PACKAGECLOUD_SIGNING_GPG }}
- name: "Setup Ruby for packagecloud uploads"
uses: ruby/setup-ruby@v1
with:
ruby-version: '2.7'
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
- name: "Install packagecloud gem"
run: gem install package_cloud
- uses: actions/setup-go@v3
with:
go-version: '>=1.19.3'
cache: true
# More assembly might be required: Docker logins, GPG, etc. It all depends
# on your needs.
- name: "make key file"
run: "echo '${{ secrets.PACKAGECLOUD_SIGNING_GPG }}' > /tmp/key.gpg"
- uses: goreleaser/goreleaser-action@v3
with:
# either 'goreleaser' (default) or 'goreleaser-pro':
distribution: goreleaser-pro
version: latest
args: release --rm-dist
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# Your GoReleaser Pro key, if you are using the 'goreleaser-pro'
# distribution:
GORELEASER_KEY: ${{ secrets.GORELEASER_KEY }}
DOCKER_REGISTRY: ${{ env.DOCKER_REGISTRY }}
DOCKER_IMAGE_NAME: ${{ env.DOCKER_IMAGE_NAME }}
PACKAGECLOUD_TOKEN: ${{ secrets.PACKAGECLOUD_TOKEN }}
PACKAGECLOUD_SIGNING_GPG: /tmp/key.gpg
PACKAGECLOUD_SIGNING_KEY_ID: ${{ steps.import_gpg.outputs.keyid }}