Merge pull request #87 from authzed/fixkust #3
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
name: "Release" | |
on: # yamllint disable-line rule:truthy | |
push: | |
tags: | |
- "*" | |
permissions: | |
contents: "write" | |
packages: "write" | |
jobs: | |
goreleaser: | |
runs-on: "ubuntu-latest" | |
env: | |
KUSTOMIZER_ARTIFACT: "oci://ghcr.io/${{github.repository_owner}}/${{github.event.repository.name}}-manifests" | |
steps: | |
- uses: "actions/checkout@v3" | |
with: | |
fetch-depth: 0 | |
- uses: "authzed/actions/setup-go@main" | |
- uses: "authzed/actions/docker-login@main" | |
with: | |
quayio_token: "${{ secrets.QUAYIO_PASSWORD }}" | |
github_token: "${{ secrets.GITHUB_TOKEN }}" | |
dockerhub_token: "${{ secrets.DOCKERHUB_ACCESS_TOKEN }}" | |
# the release directory is gitignored, which keeps goreleaser from | |
# complaining about a dirty tree | |
- name: "Copy manifests to release directory" | |
run: mkdir release && cp -R deploy release | |
- name: "Set image in release manifests" | |
uses: "mikefarah/yq@master" | |
with: | |
cmd: | | |
yq eval '.images[0].newName="ghcr.io/${{github.repository_owner}}/${{github.event.repository.name}}"' -i ./release/deploy/kustomization.yaml | |
- name: "Set tag in release manifests" | |
uses: "mikefarah/yq@master" | |
with: | |
cmd: | | |
yq eval '.images[0].newTag="${{ github.ref_name }}"' -i ./release/deploy/kustomization.yaml | |
- name: "Build release bundle.yaml" | |
uses: "karancode/kustomize-github-action@master" | |
with: | |
kustomize_build_dir: "release/deploy" | |
kustomize_output_file: "release/bundle.yaml" | |
- uses: "goreleaser/goreleaser-action@v2" | |
with: | |
distribution: "goreleaser-pro" | |
version: "latest" | |
args: "release --rm-dist" | |
env: | |
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" | |
GORELEASER_KEY: "${{ secrets.GORELEASER_KEY }}" | |
- name: "Setup Kustomizer CLI" | |
uses: "stefanprodan/kustomizer/action@main" | |
- name: "Push release manifests" | |
run: | | |
kustomizer push artifact ${KUSTOMIZER_ARTIFACT}:${{ github.ref_name }} -k ./release/deploy \ | |
--source=${{ github.repositoryUrl }} \ | |
--revision="${{ github.ref_name }}/${{ github.sha }}" | |
- name: "Tag latest release manifests" | |
run: | | |
kustomizer tag artifact ${KUSTOMIZER_ARTIFACT}:${GITHUB_REF_NAME} latest |