Cherry-pick PR #4013, #406, and #415 to release-v1.2 (#430) #35
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: Generate release artefact | |
on: | |
push: | |
tags: | |
- "v*.*.*" | |
jobs: | |
build_release: | |
name: Build Release | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version: "^1.19" | |
- name: Install tools | |
uses: redhat-actions/openshift-tools-installer@v1 | |
with: | |
source: "github" | |
kustomize: "latest" | |
ko: "latest" | |
- name: Login to GHCR | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Docker meta | |
id: meta | |
uses: docker/metadata-action@v5 | |
with: | |
images: capi-nutanix | |
sep-tags: "," | |
sep-labels: "," | |
tags: | | |
type=semver,pattern=v{{version}} | |
type=semver,pattern=v{{major}}.{{minor}} | |
type=semver,pattern=v{{major}} | |
type=sha | |
- name: Prepare build | |
run: make manifests generate | |
- name: Build container | |
env: | |
KO_DOCKER_REPO: ghcr.io/${{ github.repository }}/controller | |
TAGS: ${{ steps.meta.outputs.tags }} | |
LABELS: ${{ steps.meta.outputs.labels }} | |
PLATFORMS: linux/amd64,linux/arm64,linux/arm | |
run: | | |
PTAGS=`echo $TAGS | sed 's/capi-nutanix://g'` | |
export SOURCE_DATE_EPOCH=$(date +%s) | |
ko build --bare --image-label "$LABELS" -t "$PTAGS" --platform=$PLATFORMS . | |
- name: parse semver | |
id: semver | |
env: | |
SEMVER: ${{ steps.meta.outputs.version }} | |
run: | | |
n=${SEMVER//[!0-9]/ } | |
a=(${n//\./ }) | |
echo "::set-output name=major::${a[0]}" | |
echo "::set-output name=minor::${a[1]}" | |
- name: build template | |
env: | |
NEW_IMG: ghcr.io/${{ github.repository }}/controller:${{ steps.meta.outputs.version }} | |
run: | | |
(cd config/manager && kustomize edit set image controller=$NEW_IMG) | |
make release-manifests | |
- name: generate image info | |
env: | |
NEW_IMG: ghcr.io/${{ github.repository }}/controller:${{ steps.meta.outputs.version }} | |
run: | | |
echo "## Images" >> ${{ github.workspace }}-CHANGELOG.txt | |
echo "|Name|Link|" >> ${{ github.workspace }}-CHANGELOG.txt | |
echo "|-|-|" >> ${{ github.workspace }}-CHANGELOG.txt | |
echo "|CAPX|[$NEW_IMG](https://$NEW_IMG)|" >> ${{ github.workspace }}-CHANGELOG.txt | |
- name: create release | |
uses: softprops/action-gh-release@v1 | |
with: | |
draft: false | |
prerelease: false | |
body_path: ${{ github.workspace }}-CHANGELOG.txt | |
generate_release_notes: true | |
append_body: true | |
files: | | |
out/infrastructure-components.yaml | |
out/metadata.yaml | |
out/cluster-template*.yaml |