Skip to content

Commit 1ec3706

Browse files
committed
chore(ci): improve GitHub workflows for release process
- Update docker.yml to ensure proper tag pushing with PUSH_CONDITION - Remove redundant version tag format (keeping only v-prefixed tags) - Set GH_TOKEN at job level in both release workflows - Remove unnecessary GitHub CLI authentication steps
1 parent 73ff1d4 commit 1ec3706

File tree

3 files changed

+36
-16
lines changed

3 files changed

+36
-16
lines changed

.github/workflows/docker.yml

+31-6
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,21 @@ on:
55
pull_request:
66
branches: [develop]
77
push:
8-
branches: [develop, main]
8+
branches: [develop]
99
tags: ["v*"]
1010

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+
1116
# Add permissions block for GitHub Container Registry access
1217
permissions:
1318
contents: read
1419
packages: write
1520

1621
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) }}
1823

1924
jobs:
2025
build-base-image:
@@ -23,7 +28,10 @@ jobs:
2328
version: ${{ steps.version.outputs.version }}
2429

2530
steps:
26-
- uses: actions/checkout@v4
31+
- name: Check out repository
32+
uses: actions/checkout@v4
33+
with:
34+
fetch-depth: 0
2735
- name: Login to GitHub Container Registry
2836
uses: docker/login-action@v3
2937
with:
@@ -82,7 +90,10 @@ jobs:
8290
rocksdb_backup,
8391
]
8492
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
8697
- name: Login to GitHub Container Registry
8798
uses: docker/login-action@v3
8899
with:
@@ -114,7 +125,6 @@ jobs:
114125
ghcr.io/${{ github.repository_owner }}/aura-${{ matrix.binary-name }}
115126
tags: |
116127
type=semver,pattern=v{{version}}
117-
type=semver,pattern={{version}}
118128
type=raw,value=latest,enable={{is_default_branch}}
119129
120130
- name: Docker metadata for branch
@@ -133,7 +143,7 @@ jobs:
133143
with:
134144
context: .
135145
file: docker/app.Dockerfile
136-
push: ${{ env.PUSH_CONDITION || startsWith(github.ref, 'refs/tags/') }}
146+
push: ${{ env.PUSH_CONDITION }}
137147
tags: ${{ startsWith(github.ref, 'refs/tags/') && steps.meta_tag.outputs.tags || steps.meta_branch.outputs.tags }}
138148
labels: ${{ steps.meta.outputs.labels }}
139149
build-args: |
@@ -157,3 +167,18 @@ jobs:
157167
"version": "${{ needs.build-base-image.outputs.version }}"
158168
}
159169
}'
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+
}'

.github/workflows/release-finalize.yml

+3-6
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,11 @@ jobs:
1515
finalize-release:
1616
if: github.event.pull_request.merged == true && startsWith(github.event.pull_request.head.ref, 'release/v')
1717
runs-on: ubuntu-latest
18+
env:
19+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
1820
steps:
1921
- name: Check out repository
20-
uses: actions/checkout@v3
22+
uses: actions/checkout@v4
2123
with:
2224
fetch-depth: 0 # Fetch all history for proper tagging
2325

@@ -27,11 +29,6 @@ jobs:
2729
git config --global user.name "GitHub Actions"
2830
git config --global user.email "[email protected]"
2931
30-
- name: Setup GitHub CLI
31-
run: |
32-
set -e
33-
echo ${{ secrets.GITHUB_TOKEN }} | gh auth login --with-token
34-
3532
- name: Download changelog artifact
3633
uses: actions/download-artifact@v4
3734
with:

.github/workflows/release-prepare.yml

+2-4
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ jobs:
2525
version: ${{ inputs.version }} # Output the version for use in other jobs
2626
tag_name: v${{ inputs.version }}
2727
release_branch: release/v${{ inputs.version }}
28+
env:
29+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2830

2931
steps:
3032
- name: Check out repository
@@ -48,10 +50,6 @@ jobs:
4850
git config --global user.name "GitHub Actions"
4951
git config --global user.email "[email protected]"
5052
51-
- name: Setup GitHub CLI
52-
run: |
53-
echo ${{ secrets.GITHUB_TOKEN }} | gh auth login --with-token
54-
5553
- name: Install dependencies
5654
run: |
5755
set -e

0 commit comments

Comments
 (0)