forked from kanisterio/kanister
-
Notifications
You must be signed in to change notification settings - Fork 0
65 lines (60 loc) · 1.9 KB
/
kanister-image-build.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
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@96383f45573cb7f253c731d3b3ab81c87ef81934 # v5.0.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@0565240e2d4ab88bba5387d719585280857ece09 # v5.0.0
with:
context: "{{defaultContext}}:docker/build"
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}