-
Notifications
You must be signed in to change notification settings - Fork 46
150 lines (132 loc) · 4.53 KB
/
Copy pathdocker-build-deeploy-gap9.yml
File metadata and controls
150 lines (132 loc) · 4.53 KB
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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
# SPDX-FileCopyrightText: 2025 ETH Zurich and University of Bologna
#
# SPDX-License-Identifier: Apache-2.0
---
name: Docker • Build Deeploy GAP9 Container
"on":
workflow_dispatch:
inputs:
docker_image_deeploy:
description: "Deeploy Image to use"
required: false
default: "ghcr.io/pulp-platform/deeploy:latest"
jobs:
prepare:
name: Fetch branch name or tag
runs-on: ubuntu-latest
outputs:
docker_tag: ${{ steps.generate_tag.outputs.docker_tag }}
steps:
- uses: actions/checkout@v4
- name: Set up environment variables
run: |
echo "BRANCH_NAME=${GITHUB_REF##*/}" >> $GITHUB_ENV
echo "TAG_NAME=${GITHUB_REF##*/}" >> $GITHUB_ENV
echo "IS_TAG=${GITHUB_REF_TYPE}" >> $GITHUB_ENV
- name: Set Docker tag
id: generate_tag
run: |
if [[ "${{ env.IS_TAG }}" == "tag" ]]; then
echo "docker_tag=${{ env.TAG_NAME }}" >> $GITHUB_OUTPUT
else
echo "docker_tag=${{ env.BRANCH_NAME }}" >> $GITHUB_OUTPUT
fi
build-deeploy-gap9:
name: Build Deeploy GAP9 Image
needs: [prepare]
runs-on: ${{ matrix.runner }}
outputs:
digest-amd64: ${{ steps.digest.outputs.digest-amd64 }}
digest-arm64: ${{ steps.digest.outputs.digest-arm64 }}
strategy:
fail-fast: false
matrix:
platform: [amd64, arm64]
include:
- platform: amd64
runner: ubuntu-latest
- platform: arm64
runner: ubuntu-22.04-arm
steps:
- uses: actions/checkout@v4
- name: Free up disk space
uses: jlumbroso/free-disk-space@v1.3.1
with:
tool-cache: true
android: true
dotnet: true
haskell: true
large-packages: true
- uses: docker/setup-buildx-action@v3
- name: GHCR Log-in
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build Cache for Docker
id: cache
uses: actions/cache@v4
with:
path: var-ccache
key: ${{ runner.os }}-${{ matrix.platform }}-build-cache-deeploy-gap9
- name: Inject build-cache
uses: reproducible-containers/buildkit-cache-dance@v3.1.0
with:
cache-map: |
{
"var-ccache": "/ccache"
}
skip-extraction: ${{ steps.cache.outputs.cache-hit }}
- name: Lower Case Repository Name
run: |
echo "OWNER_LC=${OWNER,,}" >>${GITHUB_ENV}
env:
OWNER: "${{ github.repository_owner }}"
- name: Load SSH key
uses: webfactory/ssh-agent@v0.9.0
with:
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}
- name: Build and push final Deeploy image
id: build
uses: docker/build-push-action@v6
with:
platforms: linux/${{ matrix.platform }}
context: .
cache-from: type=gha
cache-to: type=gha,mode=min
file: Container/Dockerfile.deeploy-gap9
push: true
build-args: |
DEEPLOY_IMAGE=${{ github.event.inputs.docker_image_deeploy }}
ssh: default
outputs: type=image,name=ghcr.io/${{ env.OWNER_LC }}/deeploy-gap9,annotation-index=true,name-canonical=true,push=true
- name: Extract image digest
id: digest
run: echo "digest-${{ matrix.platform }}=${{ steps.build.outputs.digest }}" >> $GITHUB_OUTPUT
merge-deeploy-gap9-images:
name: Merge Deeploy GAP9 Images
runs-on: ubuntu-latest
needs: [prepare, build-deeploy-gap9]
steps:
- name: GHCR Log-in
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Lower Case Repository Name
run: |
echo "OWNER_LC=${OWNER,,}" >>${GITHUB_ENV}
env:
OWNER: "${{ github.repository_owner }}"
- name: Merge Deeploy GAP9 Images
uses: Noelware/docker-manifest-action@v1
with:
inputs: |
ghcr.io/${{ env.OWNER_LC }}/deeploy-gap9@${{ needs.build-deeploy-gap9.outputs.digest-amd64 }},
ghcr.io/${{ env.OWNER_LC }}/deeploy-gap9@${{ needs.build-deeploy-gap9.outputs.digest-arm64 }}
tags: |
ghcr.io/${{ env.OWNER_LC }}/deeploy-gap9:latest,
ghcr.io/${{ env.OWNER_LC }}/deeploy-gap9:${{ needs.prepare.outputs.docker_tag }}
push: true