-
Notifications
You must be signed in to change notification settings - Fork 1
138 lines (120 loc) · 4.87 KB
/
Copy pathrelease.yml
File metadata and controls
138 lines (120 loc) · 4.87 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
name: build image on release
on:
release:
types: [published]
jobs:
build-image:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Set up JDK
uses: actions/setup-java@v2
with:
java-version: '21'
distribution: 'temurin'
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Grant execute permission for Gradlew
run: chmod +x hub/dispatcher/gradlew
- name: Extract release information
id: extract_info
run: |
RELEASE_NAME=${{ github.event.release.name }}
echo $RELEASE_NAME
if [[ "$RELEASE_NAME" == dispatcher-* ]]; then
PROJECT="dispatcher"
VERSION=${RELEASE_NAME#dispatcher-}
elif [[ "$RELEASE_NAME" == lrm-* ]]; then
PROJECT="lrm"
VERSION=${RELEASE_NAME#lrm-}
elif [[ "$RELEASE_NAME" == landing-* ]]; then
PROJECT="landing"
VERSION=${RELEASE_NAME#landing-}
elif [[ "$RELEASE_NAME" == healthcheck-* ]]; then
PROJECT="healthcheck"
VERSION=${RELEASE_NAME#healthcheck-}
elif [[ "$RELEASE_NAME" == carto-* ]]; then
PROJECT="carto"
VERSION=${RELEASE_NAME#carto-}
else
echo "Invalid release name prefix. Must be 'dispatcher', 'lrm', 'landing', 'carto' or 'healthcheck'."
exit 1
fi
PATTERN="^([0-9]+\.[0-9]+(\.[0-9]+)?)(-[A-Za-z0-9\.]+)*$"
if [[ ! "$VERSION" =~ $PATTERN ]]; then
echo "Invalid version number"
exit 1
fi
echo "::set-output name=project::$PROJECT"
echo "::set-output name=version::$VERSION"
- name: Login to Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Run tests, build and push dispatcher Docker image
if: steps.extract_info.outputs.project == 'dispatcher'
working-directory: hub/dispatcher
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TAG: ${{ steps.extract_info.outputs.version }}
run: |
# Build for each model version
for MODEL_VERSION in "1.1" "2.2" "3.0-RC-6"; do
IMAGE_TAG="${TAG}-model-${MODEL_VERSION}"
echo "Building image for $IMAGE_TAG"
./gradlew jib \
-Pversion=$TAG \
-PmodelVersion=$MODEL_VERSION \
--image ghcr.io/${{ github.repository_owner }}/dispatcher:$IMAGE_TAG
done
- name: Build and push lrm backend Docker image
if: steps.extract_info.outputs.project == 'lrm'
uses: docker/build-push-action@v5
with:
push: true
platforms: linux/amd64
tags: ghcr.io/${{ github.repository_owner }}/hub-lrm-back:${{ steps.extract_info.outputs.version }}
context: ./web/lrm/server
- name: Build and push lrm frontend Docker image
if: steps.extract_info.outputs.project == 'lrm'
uses: docker/build-push-action@v5
with:
push: true
platforms: linux/amd64
tags: ghcr.io/${{ github.repository_owner }}/hub-lrm-front:${{ steps.extract_info.outputs.version }}
context: ./web/lrm/client
- name: Build and push landing Docker image
if: steps.extract_info.outputs.project == 'landing'
uses: docker/build-push-action@v5
with:
push: true
platforms: linux/amd64
tags: ghcr.io/${{ github.repository_owner }}/hub-web-landing:${{ steps.extract_info.outputs.version }}
context: ./web/landing
- name: Build and push healthcheck service Docker image
if: steps.extract_info.outputs.project == 'healthcheck'
uses: docker/build-push-action@v5
with:
push: true
platforms: linux/amd64
tags: ghcr.io/${{ github.repository_owner }}/hub-healthcheck:${{ steps.extract_info.outputs.version }}
context: ./tools/healthcheck
- name: Build and push carto backend Docker image
if: steps.extract_info.outputs.project == 'carto'
uses: docker/build-push-action@v5
with:
push: true
platforms: linux/amd64
tags: ghcr.io/${{ github.repository_owner }}/hub-carto-back:${{ steps.extract_info.outputs.version }}
context: ./web/carto/server
- name: Build and push carto frontend Docker image
if: steps.extract_info.outputs.project == 'carto'
uses: docker/build-push-action@v5
with:
push: true
platforms: linux/amd64
tags: ghcr.io/${{ github.repository_owner }}/hub-carto-front:${{ steps.extract_info.outputs.version }}
context: ./web/carto/client