Update build image #18
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: build-kanister-image | |
on: | |
workflow_dispatch: | |
inputs: | |
tag: | |
description: 'Image tag in the format vx.x.x' | |
required: true | |
type: string | |
env: | |
REGISTRY: ghcr.io | |
IMAGE_NAME: kanisterio/build | |
jobs: | |
# TODO: Enable following when we want to automate this workflow on push to master branch | |
# check-files: | |
# runs-on: ubuntu-latest | |
# outputs: | |
# changed: ${{ steps.changed-files.outputs.any_changed }} | |
# steps: | |
# - uses: actions/checkout@v3 | |
# with: | |
# fetch-depth: 0 | |
# - uses: tj-actions/changed-files@v35 | |
# name: Get changed files | |
# id: changed-files | |
# with: | |
# files: docker/build/Dockerfile | |
build: | |
permissions: | |
contents: read | |
packages: write | |
runs-on: ubuntu-latest | |
# TODO: Uncomment following when we enable check-file job | |
# needs: check-files | |
# if: needs.check-files.outputs.changed == 'true' | |
steps: | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@68827325e0b33c7199eb31dd4e31fbe9023e06e3 # v3.0.0 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@0d103c3126aa41d772a8362f6aa67afac040f80c # v3.1.0 | |
- name: Image metadata | |
id: meta | |
uses: docker/metadata-action@8e5442c4ef9f78752691e2d8f8d19755c6f78e81 # v5.5.1 | |
with: | |
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | |
tags: | | |
type=ref,event=branch | |
type=sha | |
{{date 'YYYY.MM.DD-HHmm'}} | |
${{ inputs.tag }} | |
- name: Login to GHCR | |
uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d # v3.0.0 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build and push | |
uses: docker/build-push-action@4a13e500e55cf31b7a5d59a38ab2040ab0f42f56 # v5.1.0 | |
with: | |
context: "{{defaultContext}}:docker/build" | |
platforms: linux/amd64,linux/arm64 | |
push: true | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} |