-
Notifications
You must be signed in to change notification settings - Fork 9
73 lines (65 loc) · 2.18 KB
/
image-push.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
66
67
68
69
70
71
72
73
name: Push container image
on:
push:
branches:
- main
tags:
- 'v*.*.*'
env:
image-push-owner: 'kubevirt'
jobs:
push:
name: Image push
runs-on: ubuntu-latest
steps:
- name: Check out code into the Go module directory
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Container Registry
if: github.repository_owner == 'kubevirt'
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Version metadata
run: |
echo "git_commit_hash=$(git describe --no-match --always --abbrev=40 --dirty)" >> $GITHUB_ENV
- name: Set lower case repository name
run: |
echo "REPOSITORY_LC=${REPOSITORY,,}" >>${GITHUB_ENV}
env:
REPOSITORY: '${{ github.repository }}'
- name: Push latest container image
if: github.repository_owner == 'kubevirt'
uses: docker/build-push-action@v6
with:
context: .
platforms: linux/amd64,linux/s390x,linux/arm64
push: true
tags: ghcr.io/${{ env.REPOSITORY_LC }}:latest
file: Dockerfile
build-args: |
git_sha=${{ env.git_commit_hash }}
- name: Push tagged container image
if: startsWith(github.ref, 'refs/tags/')
uses: docker/build-push-action@v6
with:
context: .
platforms: linux/amd64,linux/s390x,linux/arm64
push: true
tags: ghcr.io/${{ env.REPOSITORY_LC }}:${{ github.ref_name }}
file: Dockerfile
build-args: |
git_sha=${{ env.git_commit_hash }}
- name: Update release manifests
if: startsWith(github.ref, 'refs/tags/')
run: IMAGE=ghcr.io/${{ env.REPOSITORY_LC }}:${{ github.ref_name }} hack/update-manifest.sh
- name: Release the kraken
uses: softprops/action-gh-release@v2
if: startsWith(github.ref, 'refs/tags/')
with:
generate_release_notes: true
files: |
manifests/secondarydns.yaml