-
Notifications
You must be signed in to change notification settings - Fork 0
100 lines (87 loc) · 3.22 KB
/
Copy pathdevops.yml
File metadata and controls
100 lines (87 loc) · 3.22 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
name: DevOps — Build and Publish Services
on:
workflow_dispatch:
push:
branches: [main]
paths-ignore:
- 'training-random-check/**'
release:
types: [published]
jobs:
build-and-publish:
runs-on: ubuntu-latest
# Only respond to model-* releases; other releases are ignored
if: >
github.event_name != 'release' ||
startsWith(github.event.release.tag_name, 'model-')
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v4
- name: Set up Java 21
uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'temurin'
cache: maven
- name: Download latest model from GitHub Releases
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
LATEST_MODEL_TAG=$(gh release list --limit 20 --json tagName \
--jq '[.[] | select(.tagName | startswith("model-"))][0].tagName')
if [ -n "$LATEST_MODEL_TAG" ]; then
echo "Downloading model from release: $LATEST_MODEL_TAG"
gh release download "$LATEST_MODEL_TAG" \
--pattern 'random-model.json' \
--dir getting-random/
else
echo "No trained model found — using empty placeholder"
echo '{"version":"none","trainedAt":"","totalSamples":0,"sources":{}}' \
> getting-random/random-model.json
fi
- name: Log in to GHCR
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Lowercase repository owner
id: repo
run: echo "owner=${GITHUB_REPOSITORY_OWNER,,}" >> "$GITHUB_OUTPUT"
- name: Build getting-random JAR
working-directory: getting-random
run: mvn package -DskipTests -Dquarkus.package.jar.type=uber-jar
- name: Build and push getting-random
uses: docker/build-push-action@v6
with:
context: getting-random
push: true
tags: |
ghcr.io/${{ steps.repo.outputs.owner }}/mlops-getting-random:latest
ghcr.io/${{ steps.repo.outputs.owner }}/mlops-getting-random:${{ github.sha }}
- name: Build and push python-random
uses: docker/build-push-action@v6
with:
context: python-random
push: true
tags: |
ghcr.io/${{ steps.repo.outputs.owner }}/mlops-python-random:latest
ghcr.io/${{ steps.repo.outputs.owner }}/mlops-python-random:${{ github.sha }}
- name: Build and push golang-random
uses: docker/build-push-action@v6
with:
context: golang-random
push: true
tags: |
ghcr.io/${{ steps.repo.outputs.owner }}/mlops-golang-random:latest
ghcr.io/${{ steps.repo.outputs.owner }}/mlops-golang-random:${{ github.sha }}
- name: Build and push js-random
uses: docker/build-push-action@v6
with:
context: js-random
push: true
tags: |
ghcr.io/${{ steps.repo.outputs.owner }}/mlops-js-random:latest
ghcr.io/${{ steps.repo.outputs.owner }}/mlops-js-random:${{ github.sha }}