Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
78 changes: 58 additions & 20 deletions .github/workflows/template-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,14 @@ jobs:
permissions:
contents: read
id-token: write
strategy:
fail-fast: false
matrix:
include:
- image: harvester-node-manager
dockerfile: package/Dockerfile
- image: harvester-node-manager-webhook
dockerfile: package/Dockerfile.webhook
steps:
- name: Checkout code without refs
if: ${{ inputs.refs == '' }}
Expand All @@ -117,35 +125,65 @@ jobs:
- name: Package webhook
run: make package-webhook

- name: Read Secrets
uses: rancher-eio/read-vault-secrets@d266f55186f80a893839f6e15662e67388e443e6 # v3
- name: Resolve registries
id: resolve
uses: harvester/harvester-actions/actions/resolve-registries@284eb4af3a007f2dbaa0717ed19413f2980c5365 # 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
release-tag-name: ${{ inputs.release-tag-name }}
is-release: ${{ github.event_name == 'release' && github.event.action == 'published' }}

- name: Set image tag
run: echo "IMAGE_TAG=${RELEASE_TAG_NAME#prime-}" >> "$GITHUB_ENV"
env:
RELEASE_TAG_NAME: ${{ inputs.release-tag-name }}

- name: Login to Docker Hub
uses: docker/login-action@650006c6eb7dba73a995cc03b0b2d7f5ca915bee # v4
id: login-docker
if: ${{ steps.resolve.outputs.use-docker-io == 'true' }}
uses: harvester/harvester-actions/actions/login-docker-hub@284eb4af3a007f2dbaa0717ed19413f2980c5365 # main

- name: Publish public ${{ matrix.image }} image
if: ${{ steps.resolve.outputs.use-docker-io == 'true' }}
uses: harvester/harvester-actions/actions/publish-public-image@284eb4af3a007f2dbaa0717ed19413f2980c5365 # main
with:
username: ${{ env.DOCKER_USERNAME }}
password: ${{ env.DOCKER_PASSWORD }}
context: .
dockerfile: ${{ matrix.dockerfile }}
image: ${{ matrix.image }}
tag: ${{ env.IMAGE_TAG }}
platforms: ${{ env.PLATFORMS }}
registry: ${{ steps.login-docker.outputs.registry }}
repository: ${{ steps.login-docker.outputs.repository }}

- name: Login to Staging Registry
id: login-staging
if: ${{ steps.resolve.outputs.use-staging == 'true' }}
uses: harvester/harvester-actions/actions/login-staging-registry@284eb4af3a007f2dbaa0717ed19413f2980c5365 # main

- name: Docker Build node-manager
uses: docker/build-push-action@ca052bb54ab0790a636c9b5f226502c73d547a25 # v5
- name: Publish staging ${{ matrix.image }} image
if: ${{ steps.resolve.outputs.use-staging == 'true' }}
uses: harvester/harvester-actions/actions/publish-prime-image@284eb4af3a007f2dbaa0717ed19413f2980c5365 # main
with:
provenance: false
context: .
dockerfile: ${{ matrix.dockerfile }}
image: ${{ matrix.image }}
tag: ${{ env.IMAGE_TAG }}
platforms: ${{ env.PLATFORMS }}
file: package/Dockerfile
push: ${{ inputs.push }}
tags: rancher/harvester-node-manager:${{ inputs.release-tag-name }}
registry: ${{ steps.login-staging.outputs.registry }}
repository: ${{ steps.login-staging.outputs.repository }}

- name: Login to Prime Registry
id: login-prime
if: ${{ steps.resolve.outputs.use-prime == 'true' }}
uses: harvester/harvester-actions/actions/login-prime-registry@284eb4af3a007f2dbaa0717ed19413f2980c5365 # main

- name: Docker Build node-manager-webhook
uses: docker/build-push-action@ca052bb54ab0790a636c9b5f226502c73d547a25 # v5
- name: Publish prime ${{ matrix.image }} image
if: ${{ steps.resolve.outputs.use-prime == 'true' }}
uses: harvester/harvester-actions/actions/publish-prime-image@284eb4af3a007f2dbaa0717ed19413f2980c5365 # main
with:
provenance: false
context: .
dockerfile: ${{ matrix.dockerfile }}
image: ${{ matrix.image }}
tag: ${{ env.IMAGE_TAG }}
platforms: ${{ env.PLATFORMS }}
file: package/Dockerfile.webhook
push: ${{ inputs.push }}
tags: rancher/harvester-node-manager-webhook:${{ inputs.release-tag-name }}
registry: ${{ steps.login-prime.outputs.registry }}
repository: ${{ steps.login-prime.outputs.repository }}
Loading