forked from open-edge-platform/scenescape
-
Notifications
You must be signed in to change notification settings - Fork 0
140 lines (124 loc) · 5.32 KB
/
weekly-build.yml
File metadata and controls
140 lines (124 loc) · 5.32 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
---
# SPDX-FileCopyrightText: (C) 2025 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
name: "[Build] Weekly Build Images"
run-name: "[Build] Weekly Build Images"
on:
schedule:
- cron: "59 6 * * 3" # Each Wednesday at 06:59 UTC (Tuesday 11:59pm PST)
workflow_dispatch: {}
permissions: {}
jobs:
build:
name: "Build, Tag, Scan and Push Images"
runs-on: ubuntu-latest
outputs:
image_tag: ${{ steps.determine-tag.outputs.image_tag }}
permissions:
contents: read
packages: write
id-token: write
strategy:
fail-fast: false
matrix:
images:
[
scenescape-autocalibration,
scenescape-controller,
scenescape-manager,
]
steps:
- name: "Set up Docker Buildx"
uses: docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f # v3.12.0
- name: "Checkout code"
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
ref: ${{ github.ref }}
persist-credentials: false
- name: "Build image scene_common"
run: |
echo "Building scene_common"
make -C scene_common
- name: "Build image ${{ matrix.images }}"
run: |
if [[ "${{ matrix.images }}" == "scenescape-autocalibration" ]]; then
echo "Building ${{ matrix.images }}"
make -C autocalibration
elif [[ "${{ matrix.images }}" == "scenescape-controller" ]]; then
echo "Building ${{ matrix.images }}"
make -C controller
elif [[ "${{ matrix.images }}" == "scenescape-manager" ]]; then
echo "Building ${{ matrix.images }}"
make -C manager
fi
- name: "Determine Image Tag"
id: determine-tag
run: |
version=""
if [ -f version.txt ]; then
version=v$(tr -d ' \n' < version.txt)
else
echo "version.txt not found."
exit 1
fi
# If version.txt contains "rc", use its content as image tag
if grep -q "rc" version.txt; then
tag="$version"
echo "image_tag=$tag" >> $GITHUB_OUTPUT
else
if [ "${{ github.event_name }}" == "workflow_dispatch" ]; then
# If version.txt contains "dev", add sha to image tag
if grep -q "dev" version.txt; then
commit_hash=$(git rev-parse --short HEAD)
tag="${version:+$version-}$commit_hash"
echo "image_tag=$tag" >> $GITHUB_OUTPUT
else
echo "No 'dev' found in version.txt. Using version from version.txt as image tag."
tag="$version"
echo "image_tag=$tag" >> $GITHUB_OUTPUT
fi
else
date_tag=$(date -u +'%Y%m%d')
tag="${version:+$version-}$date_tag"
echo "image_tag=$tag" >> $GITHUB_OUTPUT
fi
fi
- name: "Tag images"
run: |
docker tag ${{ matrix.images }}:latest ghcr.io/open-edge-platform/edge-ai-libraries/intel/${{ matrix.images }}:${{ steps.determine-tag.outputs.image_tag }}
echo "Tagged ${{ matrix.images }}:latest as ghcr.io/open-edge-platform/edge-ai-libraries/intel/${{ matrix.images }}:${{ steps.determine-tag.outputs.image_tag }}"
- name: "Log in to GHCR"
uses: docker/login-action@c94ce9fb468520275223c153574b00df6fe4bcc9 # v3.7.0
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: "Push images"
run: |
docker push ghcr.io/open-edge-platform/edge-ai-libraries/intel/${{ matrix.images }}:${{ steps.determine-tag.outputs.image_tag }}
- name: Install skopeo
run: sudo apt update && sudo apt install -y skopeo jq
- name: "Get image digest"
id: digest
env:
IMAGE: ghcr.io/open-edge-platform/edge-ai-libraries/intel/${{ matrix.images }}:${{ steps.determine-tag.outputs.image_tag }}
run: |
DIGEST=$(skopeo inspect docker://$IMAGE | jq -r '.Digest')
echo "digest=${DIGEST}" >> $GITHUB_OUTPUT
- name: "Install Cosign"
uses: sigstore/cosign-installer@faadad0cce49287aee09b3a48701e75088a2c6ad # v4.0.0
- name: "Sign Docker images using Cosign (keyless)"
run: |
cosign sign --yes ghcr.io/open-edge-platform/edge-ai-libraries/intel/${{ matrix.images }}@${{ steps.digest.outputs.digest }}
echo "Signed ghcr.io/open-edge-platform/edge-ai-libraries/intel/${{ matrix.images }}@${{ steps.digest.outputs.digest }}"
- name: "Save ${{ matrix.images }} image info"
id: save-image-info
run: |
echo "image_name=ghcr.io/open-edge-platform/edge-ai-libraries/intel/${{ matrix.images }}:${{ steps.determine-tag.outputs.image_tag }}" >> "$GITHUB_OUTPUT"
echo "image_name=ghcr.io/open-edge-platform/edge-ai-libraries/intel/${{ matrix.images }}:${{ steps.determine-tag.outputs.image_tag }}" >> $GITHUB_STEP_SUMMARY
echo "image_digest=${{ steps.digest.outputs.digest }}" >> "$GITHUB_OUTPUT"
echo "image_digest=${{ steps.digest.outputs.digest }}" >> $GITHUB_STEP_SUMMARY
- name: Clean up
if: always()
run: |
docker system prune -a --volumes -f || true