5
5
pull_request :
6
6
branches : [develop]
7
7
push :
8
- branches : [develop, main ]
8
+ branches : [develop]
9
9
tags : ["v*"]
10
10
11
+ # Add concurrency to cancel in-progress runs on the same ref
12
+ concurrency :
13
+ group : ${{ github.workflow }}-${{ github.ref }}
14
+ cancel-in-progress : true
15
+
11
16
# Add permissions block for GitHub Container Registry access
12
17
permissions :
13
18
contents : read
14
19
packages : write
15
20
16
21
env :
17
- PUSH_CONDITION : ${{ github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && contains(fromJSON('["refs/heads/main", "refs/heads/ develop"]'), github.ref) ) }}
22
+ PUSH_CONDITION : ${{ github.event_name == 'push' && (contains(fromJSON('["refs/heads/develop"]'), github.ref) || startsWith (github.ref, 'refs/tags/')) || github. event_name == 'workflow_dispatch' && contains(fromJSON('["refs/heads/develop"]'), github.ref) }}
18
23
19
24
jobs :
20
25
build-base-image :
23
28
version : ${{ steps.version.outputs.version }}
24
29
25
30
steps :
26
- - uses : actions/checkout@v4
31
+ - name : Check out repository
32
+ uses : actions/checkout@v4
33
+ with :
34
+ fetch-depth : 0
27
35
- name : Login to GitHub Container Registry
28
36
uses : docker/login-action@v3
29
37
with :
82
90
rocksdb_backup,
83
91
]
84
92
steps :
85
- - uses : actions/checkout@v4 # Need to checkout code for Dockerfile
93
+ - name : Check out repository
94
+ uses : actions/checkout@v4
95
+ with :
96
+ fetch-depth : 0
86
97
- name : Login to GitHub Container Registry
87
98
uses : docker/login-action@v3
88
99
with :
@@ -114,7 +125,6 @@ jobs:
114
125
ghcr.io/${{ github.repository_owner }}/aura-${{ matrix.binary-name }}
115
126
tags : |
116
127
type=semver,pattern=v{{version}}
117
- type=semver,pattern={{version}}
118
128
type=raw,value=latest,enable={{is_default_branch}}
119
129
120
130
- name : Docker metadata for branch
@@ -133,7 +143,7 @@ jobs:
133
143
with :
134
144
context : .
135
145
file : docker/app.Dockerfile
136
- push : ${{ env.PUSH_CONDITION || startsWith(github.ref, 'refs/tags/') }}
146
+ push : ${{ env.PUSH_CONDITION }}
137
147
tags : ${{ startsWith(github.ref, 'refs/tags/') && steps.meta_tag.outputs.tags || steps.meta_branch.outputs.tags }}
138
148
labels : ${{ steps.meta.outputs.labels }}
139
149
build-args : |
@@ -157,3 +167,18 @@ jobs:
157
167
"version": "${{ needs.build-base-image.outputs.version }}"
158
168
}
159
169
}'
170
+
171
+ - name : Repository dispatch for production
172
+ if : startsWith(github.ref, 'refs/tags/')
173
+ run : |
174
+ curl -X POST \
175
+ -H "Authorization: token ${{ secrets.DISPATCH_TOKEN_PROD }}" \
176
+ -H "Accept: application/vnd.github+json" \
177
+ https://api.github.com/repos/adm-metaex/aura-config-prod/dispatches \
178
+ -d '{
179
+ "event_type": "deploy",
180
+ "client_payload": {
181
+ "services": "${{ env.PUSH_CONDITION && 'ingester,slot_persister,backfill,api,synchronizer,rocksdb_backup' || '' }}",
182
+ "version": "${{ needs.build-base-image.outputs.version }}"
183
+ }
184
+ }'
0 commit comments