Skip to content

Create crds in GoReleaser #15

Create crds in GoReleaser

Create crds in GoReleaser #15

Workflow file for this run

# gitjob release workflow
name: gitjob release
on:
push:
tags:
- v**
permissions:
contents: write
packages: write
id-token: write # this is important, it's how we authenticate with Vault
env:
GOARCH: amd64
CGO_ENABLED: 0
SETUP_K3D_VERSION: 'v5.5.1'
jobs:
build-gitjob:
runs-on: ubuntu-latest
if: github.repository == 'rancher/gitjob'
steps:
- name: Check out Gitjob
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: 'go.mod'
check-latest: true
- name: Run golangci-lint
uses: golangci/golangci-lint-action@v6.0.1
with:
# Required: the version of golangci-lint is required and must be specified without patch version: we always
# use the latest patch version.
version: v1.58
args: --timeout=10m --config=.golangci.json
- name: "Read Vault Secrets"
uses: rancher-eio/read-vault-secrets@main
with:
secrets: |
secret/data/github/repo/${{ github.repository }}/dockerhub/rancher/credentials username | DOCKER_USERNAME ;
secret/data/github/repo/${{ github.repository }}/dockerhub/rancher/credentials password | DOCKER_PASSWORD ;
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log into Docker Container registry
uses: docker/login-action@v3
with:
username: ${{ env.DOCKER_USERNAME }}
password: ${{ env.DOCKER_PASSWORD }}
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v6
id: goreleaser
with:
distribution: goreleaser
version: '~> v2'
args: release --clean --verbose
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Upload chart to release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
repo: "rancher"
run: |
version=$(echo '${{ steps.goreleaser.outputs.metadata }}' | jq -r '.version')
tag=$(echo '${{ steps.goreleaser.outputs.metadata }}' | jq -r '.tag')
echo "publishing helm chart for (repo: $repo, tag: $tag, version: $version)"
sed -i \
-e "s/tag:.*/tag: $tag/" \
chart/values.yaml
go run pkg/crdgen/main.go > chart/templates/crds.yaml
helm package --version="$version" --app-version="$version" -d ./dist ./chart
for f in $(find dist/ -name '*.tgz'); do
gh release upload $tag $f
done