1+ name : Build and Publish Federated Catalog Image (Main)
2+
3+ on :
4+ push :
5+ branches :
6+ - " feature/deployment"
7+ paths :
8+ - ' federated-catalog/**'
9+ - ' .github/workflows/federated-catalog.yml'
10+
11+ concurrency :
12+ group : fc-main
13+ cancel-in-progress : true
14+
15+ jobs :
16+ # ------------------------------
17+ # 1. BUILD & PUSH FC DOCKER IMAGE
18+ # ------------------------------
19+ build-and-push-fc :
20+ runs-on : ubuntu-latest
21+
22+ permissions :
23+ contents : read
24+ packages : write
25+ id-token : write
26+
27+ steps :
28+ - name : Checkout repository
29+ uses : actions/checkout@v4
30+
31+ # -------- LOGIN GHCR --------
32+ - name : Login to GHCR
33+ uses : docker/login-action@v3
34+ with :
35+ registry : ghcr.io
36+ username : ${{ github.actor }}
37+ password : ${{ secrets.GITHUB_TOKEN }}
38+
39+ # -------- GRADLE BUILD --------
40+ - name : Set up JDK 17
41+ uses : actions/setup-java@v4
42+ with :
43+ distribution : temurin
44+ java-version : 17
45+
46+ - name : Make Gradle executable
47+ run : chmod +x ./gradlew
48+
49+ - name : Build federated catalog JAR
50+ run : |
51+ cd federated-catalog
52+ ./gradlew clean build
53+ # ---------------------------------
54+
55+ - name : Set dynamic tags for migrations and API
56+ id : vars
57+ run : |
58+ IMAGE_BASE_FC="ghcr.io/wake-ua/federated-catalog"
59+ DATE=$(date +%Y%m%d)
60+ SHA_SHORT=$(echo "${GITHUB_SHA}" | cut -c1-7)
61+
62+ # Tags for federated catalog image
63+ echo "FC_LATEST=${IMAGE_BASE_FC}:latest" >> $GITHUB_OUTPUT
64+ echo "FC_SHA=${IMAGE_BASE_FC}:${SHA_SHORT}" >> $GITHUB_OUTPUT
65+ echo "FC_DATE=${IMAGE_BASE_FC}:${DATE}" >> $GITHUB_OUTPUT
66+
67+ # -------- DOCKER BUILD & PUSH --------
68+ - name : Build Docker image for migrations
69+ run : |
70+ docker build -f migrations/Dockerfile \
71+ -t ${{ steps.vars.outputs.FC_LATEST }} \
72+ -t ${{ steps.vars.outputs.FC_SHA }} \
73+ -t ${{ steps.vars.outputs.FC_DATE }} \
74+ .
75+
76+ - name : Push migrations images
77+ run : |
78+ docker push ${{ steps.vars.outputs.FC_LATEST }}
79+ docker push ${{ steps.vars.outputs.FC_SHA }}
80+ docker push ${{ steps.vars.outputs.FC_DATE }}
81+ # ---------------------------------
82+
83+
0 commit comments