-
Notifications
You must be signed in to change notification settings - Fork 0
61 lines (52 loc) · 1.68 KB
/
push_image.yml
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
name: Docker Build
on:
workflow_run:
workflows: ["Release"]
types:
- completed
branches:
- main
env:
REGISTRY: wandelbots.azurecr.io
IMAGE_NAME: nova-apps/rerun
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Get version from pyproject.toml
id: version
run: |
version=$(grep '^version = ' pyproject.toml | cut -d'"' -f2)
echo "version=$version" >> $GITHUB_OUTPUT
- name: Login to Azure Container Registry
if: github.ref == 'refs/heads/main'
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ secrets.PUBLIC_REGISTRY_CI_SCOPE_NOVA_APPS_USERNAME }}
password: ${{ secrets.PUBLIC_REGISTRY_CI_SCOPE_NOVA_APPS_TOKEN }}
- name: Build and push
id: docker_build
uses: docker/build-push-action@v6
with:
context: .
push: ${{ github.ref == 'refs/heads/main' }}
load: ${{ github.ref != 'refs/heads/main' }}
tags: |
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.version.outputs.version }}
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Verify Image
if: github.ref != 'refs/heads/main'
run: |
echo "Checking built image..."
echo "Version: ${{ steps.version.outputs.version }}"
docker images | grep ${{ env.IMAGE_NAME }}