-
Notifications
You must be signed in to change notification settings - Fork 1
99 lines (85 loc) · 2.82 KB
/
Copy pathfederated-catalog.yml
File metadata and controls
99 lines (85 loc) · 2.82 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
name: Build and Publish Federated Catalog Image (Main)
on:
push:
branches:
- "main"
- "feature/deployment"
paths:
- 'federated-catalog/**'
- '.github/workflows/federated-catalog.yml'
concurrency:
group: fc-main
cancel-in-progress: true
jobs:
# ------------------------------
# 1. BUILD & PUSH FC DOCKER IMAGE
# ------------------------------
build-and-push-fc:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
id-token: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
# -------- LOGIN GHCR --------
- name: Login to GHCR
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
# -------- GRADLE BUILD --------
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 17
- name: Make Gradle executable
run: chmod +x ./gradlew
- name: Build federated catalog JAR
run: |
./gradlew :federated-catalog:clean :federated-catalog:build
# ---------------------------------
- name: Set dynamic tags for Federated Catalog
id: vars
run: |
IMAGE_BASE_FC="ghcr.io/wake-ua/federated-catalog"
DATE=$(date +%Y%m%d)
SHA_SHORT=$(echo "${GITHUB_SHA}" | cut -c1-7)
# Tags for federated catalog image
echo "FC_LATEST=${IMAGE_BASE_FC}:latest" >> $GITHUB_OUTPUT
echo "FC_SHA=${IMAGE_BASE_FC}:${SHA_SHORT}" >> $GITHUB_OUTPUT
echo "FC_DATE=${IMAGE_BASE_FC}:${DATE}" >> $GITHUB_OUTPUT
# -------- DOCKER BUILD & PUSH --------
- name: Build Docker image for Federated Catalog
run: |
docker build \
-t ${{ steps.vars.outputs.FC_LATEST }} \
-t ${{ steps.vars.outputs.FC_SHA }} \
-t ${{ steps.vars.outputs.FC_DATE }} \
./federated-catalog
- name: Push Federated Catalog images
run: |
docker push ${{ steps.vars.outputs.FC_LATEST }}
docker push ${{ steps.vars.outputs.FC_SHA }}
docker push ${{ steps.vars.outputs.FC_DATE }}
# ---------------------------------
# deploy-fc:
# runs-on: self-hosted # Runner local
# needs: build-and-push-fc
#
# steps:
# - name: Deploy backend FC
# run: |
# GITHUB_SHA=${GITHUB_SHA::7}
#
# ssh -i ${{ secrets.DEPLOY_SSH_KEY }} gh_docker_deploy@${{ secrets.FC_WEB_HOST }} "
# export FC_IMAGE_TAG=${GITHUB_SHA} &&
#
# docker pull ghcr.io/wake-ua/federated-catalog:${GITHUB_SHA} &&
# docker stack deploy -c /home/gh_docker_deploy/despliegue/docker-stack-catalog.yml federated-catalog
# "
#
#