84 lines
2.3 KiB
YAML
84 lines
2.3 KiB
YAML
name: Release
|
|
|
|
on:
|
|
push:
|
|
tags:
|
|
- 'v*'
|
|
|
|
jobs:
|
|
goreleaser:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
- # required for the changelog to work correctly
|
|
run: git fetch --prune --unshallow
|
|
- uses: actions/setup-go@v2
|
|
with:
|
|
go-version: 1.18
|
|
- name: prepare changelog
|
|
run: |
|
|
tag=${{ github.ref }}
|
|
tag=${tag##*/}
|
|
cat <<EOF | tee /tmp/release.txt
|
|
## Docker images
|
|
|
|
- \`docker pull goharbor/harbor-operator:$tag\`
|
|
EOF
|
|
- name: Import GPG key
|
|
id: import_gpg
|
|
uses: crazy-max/ghaction-import-gpg@v3
|
|
with:
|
|
gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }}
|
|
passphrase: ${{ secrets.GPG_PASSPHRASE }}
|
|
- name: Run GoReleaser
|
|
uses: goreleaser/goreleaser-action@v1
|
|
with:
|
|
version: v1.11.0
|
|
args: release --rm-dist --release-footer /tmp/release.txt
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }}
|
|
GIT_COMMIT: ${{ github.sha }}
|
|
|
|
docker:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/setup-go@v2
|
|
with:
|
|
go-version: 1.18
|
|
- uses: actions/checkout@v2
|
|
- name: Set up QEMU
|
|
uses: docker/setup-qemu-action@v1
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v2.0.0
|
|
with:
|
|
driver-opts: image=moby/buildkit:master
|
|
- name: Login to DockerHub
|
|
uses: docker/login-action@v1
|
|
with:
|
|
username: '${{ secrets.DOCKER_USER }}'
|
|
password: '${{ secrets.DOCKER_TOKEN }}'
|
|
- name: Build and push to DockerHub
|
|
uses: docker/build-push-action@v3
|
|
with:
|
|
push: true
|
|
platforms: |
|
|
linux/amd64
|
|
linux/arm64
|
|
file: Dockerfile
|
|
tags: goharbor/harbor-operator:latest
|
|
- name: Login to GitHub Container Registry
|
|
uses: docker/login-action@v2
|
|
with:
|
|
registry: ghcr.io
|
|
username: harbor
|
|
password: '${{ secrets.GHCR_TOKEN }}'
|
|
- name: Build and push go ghcr
|
|
uses: docker/build-push-action@v3
|
|
with:
|
|
push: true
|
|
platforms: |
|
|
linux/amd64
|
|
linux/arm64
|
|
file: Dockerfile
|
|
tags: ghcr.io/goharbor/harbor-operator:latest |