-
Notifications
You must be signed in to change notification settings - Fork 1
101 lines (95 loc) · 3.26 KB
/
build-images.yml
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
name: Build images
on:
pull_request:
paths:
- 'services/localega-tsd-proxy/**'
- 'services/mq-interceptor/**'
branches:
- main
jobs:
detect-changes:
runs-on: ubuntu-latest
outputs:
localega-tsd-proxy: ${{ steps.changes.outputs.localega-tsd-proxy }}
mq-interceptor: ${{ steps.changes.outputs.mq-interceptor }}
steps:
- uses: actions/checkout@v4
- uses: dorny/paths-filter@v3
id: changes
with:
filters: |
localega-tsd-proxy:
- 'services/localega-tsd-proxy/**'
mq-interceptor:
- 'services/mq-interceptor/**'
localega_tsd_proxy:
needs: detect-changes
if: needs.detect-changes.outputs.localega-tsd-proxy == 'true'
runs-on: ubuntu-latest
permissions:
contents: write
packages: write
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'temurin'
- name: Build with Gradle
run: ./gradlew services:localega-tsd-proxy:assemble
- name: Set Repository Name
id: repo_name
run: |
REPO_NAME=$(echo "${{ github.repository }}" | tr '[:upper:]' '[:lower:]')
echo "repo_name=$REPO_NAME" >> $GITHUB_ENV
- name: Log in to the Github Container registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v6
with:
context: ./services/localega-tsd-proxy
push: true
no-cache: 'true'
tags: |
ghcr.io/${{ env.repo_name }}:localega-tsd-proxy-${{ github.event.number }}
labels: |
org.opencontainers.image.source=${{ github.event.repository.clone_url }}
org.opencontainers.image.created=$(date -u +'%Y-%m-%dT%H:%M:%SZ')
org.opencontainers.image.revision=${{ github.sha }}
mq-interceptor:
needs: detect-changes
if: needs.detect-changes.outputs.mq-interceptor == 'true'
runs-on: ubuntu-latest
permissions:
contents: write
packages: write
steps:
- uses: actions/checkout@v4
- name: Set Repository Name
id: repo_name
run: |
REPO_NAME=$(echo "${{ github.repository }}" | tr '[:upper:]' '[:lower:]')
echo "repo_name=$REPO_NAME" >> $GITHUB_ENV
- name: Log in to the Github Container registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v6
with:
context: ./services/mq-interceptor
push: true
no-cache: 'true'
tags: |
ghcr.io/${{ env.repo_name }}:mq-interceptor-${{ github.event.number }}
ghcr.io/${{ env.repo_name }}:mq-interceptor-latest
labels: |
org.opencontainers.image.source=${{ github.event.repository.clone_url }}
org.opencontainers.image.created=$(date -u +'%Y-%m-%dT%H:%M:%SZ')
org.opencontainers.image.revision=${{ github.sha }}