Skip to content

Update build image

Update build image #14

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 Docker Buildx
uses: docker/setup-buildx-action@f95db51fddba0c2d1ec667646a06c2ce06100226 # v3.0.0
- name: Image metadata
id: meta
uses: docker/metadata-action@31cebacef4805868f9ce9a0cb03ee36c32df2ac4 # v5.3.0
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"
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}