-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #73 from twz123/separate-publish-image-workflow
Separate publish-image workflow
- Loading branch information
Showing
2 changed files
with
92 additions
and
43 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
# SPDX-FileCopyrightText: 2023 bootloose authors | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
name: Publish Image | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
image: | ||
type: string | ||
description: The image to be published. | ||
tag: | ||
type: string | ||
description: The tag to use for the image. Defaults to :latest if not specified. | ||
required: false | ||
default: latest | ||
secrets: | ||
QUAY_USERNAME: | ||
description: The username used to log in to Quay.io. | ||
required: true | ||
QUAY_PASSWORD: | ||
description: The password used to log in to Quay.io. | ||
required: true | ||
|
||
workflow_dispatch: | ||
inputs: | ||
image: | ||
type: string | ||
description: The image to be published. | ||
tag: | ||
type: string | ||
description: The tag to use for the image. Defaults to :latest if not specified. | ||
required: false | ||
default: latest | ||
|
||
jobs: | ||
publish_image: | ||
needs: prepare | ||
runs-on: ubuntu-20.04 | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
- name: List image platforms | ||
id: list-platforms | ||
run: | | ||
platforms=$(make -s -C images "${{ inputs.image }}-platforms") | ||
echo "platforms=${platforms}" >> $GITHUB_OUTPUT | ||
- name: Login to Quay | ||
uses: docker/login-action@v3 | ||
with: | ||
username: ${{ secrets.QUAY_USERNAME }} | ||
password: ${{ secrets.QUAY_PASSWORD }} | ||
registry: quay.io | ||
|
||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v3 | ||
with: | ||
platforms: ${{ steps.list-platforms.outputs.platforms }} | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
|
||
- name: Cache Buildx Docker layers | ||
uses: actions/cache@v4 | ||
with: | ||
path: /tmp/.buildx-cache | ||
key: ${{ runner.os }}-buildx | ||
|
||
- name: Build ${{ inputs.image }} | ||
uses: docker/build-push-action@v5 | ||
with: | ||
platforms: ${{ steps.list-platforms.outputs.platforms }} | ||
push: true | ||
tags: | | ||
quay.io/k0sproject/bootloose-${{ inputs.image }}:${{ inputs.tag }} | ||
context: images/${{ inputs.image }} | ||
cache-from: type=local,src=/tmp/.buildx-cache | ||
cache-to: type=local,dest=/tmp/.buildx-cache |
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