This repository was archived by the owner on Feb 26, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
115 lines (106 loc) · 4.63 KB
/
ci-cd.yml
File metadata and controls
115 lines (106 loc) · 4.63 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
name: CI/CD Pipeline
on:
push:
branches: [pi-7-deliverables]
permissions:
contents: read
packages: write
security-events: write
env:
REGISTRY: ghcr.io
jobs:
setup:
runs-on: ubuntu-latest
outputs:
image_base: ${{ steps.vars.outputs.image_base }}
image_base_gval: ${{ steps.vars.outputs.image_base_gval }}
pr_tag: ${{ steps.vars.outputs.pr_tag }}
commit_sha: ${{ steps.vars.outputs.commit_sha }}
commit_sha_short: ${{ steps.vars.outputs.commit_sha_short }}
test_image_tag: ${{ steps.vars.outputs.test_image_tag }}
steps:
- name: Compute image vars
id: vars
shell: bash
run: |
set -euo pipefail
ORG="$(echo "${GITHUB_REPOSITORY_OWNER}" | tr '[:upper:]' '[:lower:]')"
REPO="autoeval-jobs"
REPO_GVAL="autoeval-jobs-gval"
IMAGE_BASE="${REGISTRY}/${ORG}/${REPO}"
IMAGE_BASE_GVAL="${REGISTRY}/${ORG}/${REPO_GVAL}"
echo "image_base=${IMAGE_BASE}" >> "$GITHUB_OUTPUT"
echo "image_base_gval=${IMAGE_BASE_GVAL}" >> "$GITHUB_OUTPUT"
if [ "${GITHUB_EVENT_NAME}" = "pull_request" ]; then
PR_NUM="${{ github.event.pull_request.number }}"
PR_TAG="pr-${PR_NUM}-build"
echo "pr_tag=${PR_TAG}" >> "$GITHUB_OUTPUT"
echo "test_image_tag=${PR_TAG}" >> "$GITHUB_OUTPUT"
fi
if [ "${GITHUB_EVENT_NAME}" = "push" ]; then
COMMIT_SHA="${GITHUB_SHA}"
SHORT_SHA="${COMMIT_SHA:0:12}"
echo "commit_sha=${COMMIT_SHA}" >> "$GITHUB_OUTPUT"
echo "commit_sha_short=${SHORT_SHA}" >> "$GITHUB_OUTPUT"
echo "test_image_tag=${SHORT_SHA}" >> "$GITHUB_OUTPUT"
fi
build:
name: build
if: github.event_name == 'pull_request' || github.event_name == 'push'
runs-on: ubuntu-latest
needs: setup
steps:
- uses: actions/checkout@v4
- name: Get current date
id: date
run: echo "date=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" >> $GITHUB_OUTPUT
- name: Log in to registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build & push autoeval-jobs image
uses: docker/build-push-action@v6
with:
context: .
file: ./Dockerfile
push: true
labels: |
org.opencontainers.image.title=AutoEval Jobs
org.opencontainers.image.description=Automated evaluation jobs application
org.opencontainers.image.version=${{ github.ref_name }}
org.opencontainers.image.revision=${{ github.sha }}
org.opencontainers.image.created=${{ steps.date.outputs.date }}
org.opencontainers.image.source=${{ github.server_url }}/${{ github.repository }}
org.opencontainers.image.url=${{ github.server_url }}/${{ github.repository }}
org.opencontainers.image.documentation=${{ github.server_url }}/${{ github.repository }}
org.opencontainers.image.authors=${{ github.actor }}
org.opencontainers.image.licenses=MIT
org.opencontainers.image.vendor=Your Organization
maintainer=${{ github.actor }}
tags: |
${{ needs.setup.outputs.image_base }}:${{ needs.setup.outputs.test_image_tag }}
${{ needs.setup.outputs.image_base }}:latest
- name: Build & push autoeval-jobs-gval image
uses: docker/build-push-action@v6
with:
context: .
file: ./Dockerfile.gval
push: true
labels: |
org.opencontainers.image.title=AutoEval Jobs GVAL
org.opencontainers.image.description=Automated evaluation jobs GVAL application
org.opencontainers.image.version=${{ github.ref_name }}
org.opencontainers.image.revision=${{ github.sha }}
org.opencontainers.image.created=${{ steps.date.outputs.date }}
org.opencontainers.image.source=${{ github.server_url }}/${{ github.repository }}
org.opencontainers.image.url=${{ github.server_url }}/${{ github.repository }}
org.opencontainers.image.documentation=${{ github.server_url }}/${{ github.repository }}
org.opencontainers.image.authors=${{ github.actor }}
org.opencontainers.image.licenses=MIT
org.opencontainers.image.vendor=Your Organization
maintainer=${{ github.actor }}
tags: |
${{ needs.setup.outputs.image_base_gval }}:${{ needs.setup.outputs.test_image_tag }}
${{ needs.setup.outputs.image_base_gval }}:latest