Merge pull request #667 from makhov/k0scontrolplane-update-strategy-r… #37
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: | |
push: | |
tags: | |
- v* # Push events to matching v*, i.e. v1.0, v20.15.10 | |
jobs: | |
release: | |
name: release | |
runs-on: ubuntu-latest | |
outputs: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
tag_name: ${{ steps.branch_name.outputs.TAG_NAME }} | |
image_tag: ${{ steps.image_tag.outputs.IMAGE_TAGS }} | |
steps: | |
# Ugly hack to get the tag name | |
# github.ref gives the full reference like refs.tags.v0.0.1-beta1 | |
- name: Branch name | |
id: branch_name | |
run: | | |
echo TAG_NAME="${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT | |
- name: Create Release | |
id: create_release | |
uses: shogo82148/[email protected] | |
with: | |
release_name: ${{ steps.branch_name.outputs.TAG_NAME }} | |
draft: true # So we can manually edit before publishing | |
prerelease: ${{ contains(github.ref, '-') }} | |
- name: Prepare image tags | |
id: image_tag | |
env: | |
TAGS: ${{ steps.branch_name.outputs.TAG_NAME }} | |
# Basically just replace the '+' with '-' as '+' is not allowed in tags | |
run: | | |
echo IMAGE_TAGS="${TAGS//+/-}" >> $GITHUB_OUTPUT | |
build-image: | |
needs: | |
- release | |
runs-on: ubuntu-latest | |
steps: | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Run git checkout | |
uses: actions/checkout@v4 | |
- name: Set up Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: '1.22.6' | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Login to Quay registry | |
uses: docker/login-action@v3 | |
with: | |
registry: quay.io | |
username: ${{ secrets.QUAY_USER }} | |
password: ${{ secrets.QUAY_PASSWORD }} | |
- name: Build image and push to Docker Hub and GitHub image registry | |
uses: docker/build-push-action@v6 | |
with: | |
build-args: | | |
BUILD_IMG=golang:1.22.6 | |
context: . | |
platforms: linux/amd64,linux/arm64 | |
tags: | | |
ghcr.io/k0sproject/k0smotron:${{ needs.release.outputs.image_tag }} | |
quay.io/k0sproject/k0smotron:${{ needs.release.outputs.image_tag }} | |
push: true | |
- name: Create install files | |
if: github.repository == 'k0sproject/k0smotron' | |
run: | | |
make bootstrap-components.yaml IMG=quay.io/k0sproject/k0smotron:${{ needs.release.outputs.image_tag }} | |
make control-plane-components.yaml IMG=quay.io/k0sproject/k0smotron:${{ needs.release.outputs.image_tag }} | |
make infrastructure-components.yaml IMG=quay.io/k0sproject/k0smotron:${{ needs.release.outputs.image_tag }} | |
- name: Upload Release Assets - metadata.yaml | |
id: upload-release-asset-metadata | |
uses: shogo82148/[email protected] | |
with: | |
upload_url: ${{ needs.release.outputs.upload_url }} | |
asset_path: ./metadata.yaml | |
asset_name: metadata.yaml | |
asset_content_type: application/octet-stream | |
- name: Upload Release Assets - bootstrap-components.yaml | |
id: upload-release-asset-bootstrap | |
uses: shogo82148/[email protected] | |
with: | |
upload_url: ${{ needs.release.outputs.upload_url }} | |
asset_path: ./bootstrap-components.yaml | |
asset_name: bootstrap-components.yaml | |
asset_content_type: application/octet-stream | |
- name: Upload Release Assets - control-plane-components.yaml | |
id: upload-release-asset-control-plane | |
uses: shogo82148/[email protected] | |
with: | |
upload_url: ${{ needs.release.outputs.upload_url }} | |
asset_path: ./control-plane-components.yaml | |
asset_name: control-plane-components.yaml | |
asset_content_type: application/octet-stream | |
- name: Upload Release Assets - infrastructure-components.yaml | |
id: upload-release-asset-images | |
uses: shogo82148/[email protected] | |
with: | |
upload_url: ${{ needs.release.outputs.upload_url }} | |
asset_path: ./infrastructure-components.yaml | |
asset_name: infrastructure-components.yaml | |
asset_content_type: application/octet-stream |