Skip to content

Commit 0984663

Browse files
authored
[Improve] Build and push docker images for historical versions (#4286)
* [INFRA] Build and push docker images for historical versions * Update cron schedule for Docker image build
1 parent 09a1895 commit 0984663

File tree

1 file changed

+32
-4
lines changed

1 file changed

+32
-4
lines changed

.github/workflows/docker-push.yml

Lines changed: 32 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,8 @@ name: "Build Docker Image"
1919

2020
on:
2121
schedule:
22-
- cron: '30 02 * * *'
22+
- cron: '20 04 * * *'
2323
push:
24-
branches:
25-
- release-*
2624
tags:
2725
- 'v[2-9]+.[0-9]+.[0-9]+'
2826

@@ -31,12 +29,41 @@ concurrency:
3129
cancel-in-progress: true
3230

3331
jobs:
32+
get-tags:
33+
runs-on: ubuntu-latest
34+
if: ${{ github.repository == 'apache/streampark' && github.event_name == 'schedule' }}
35+
outputs:
36+
tags: ${{ steps.get-tags.outputs.tags }}
37+
steps:
38+
- name: Check out the repo
39+
uses: actions/checkout@v3
40+
with:
41+
fetch-depth: 0
42+
43+
- name: Get all matching tags
44+
id: get-tags
45+
run: |
46+
# 获取所有符合规则的标签
47+
TAGS=$(git tag -l | grep -E '^v[2-9]+\.[0-9]+\.[0-9]+$' | sort -V)
48+
echo "Found tags: $TAGS"
49+
50+
# 将标签转换为 JSON 数组格式
51+
TAGS_JSON=$(echo "$TAGS" | jq -R -s -c 'split("\n")[:-1]')
52+
echo "tags=$TAGS_JSON" >> $GITHUB_OUTPUT
53+
echo "Found $TAGS_JSON"
54+
3455
build_image:
3556
runs-on: ubuntu-latest
36-
if: ${{ github.repository == 'apache/streampark' }}
57+
if: ${{ github.repository == 'apache/streampark' && (github.event_name == 'push' || (github.event_name == 'schedule' && needs.get-tags.outputs.tags != '[]')) }}
58+
needs: get-tags
59+
strategy:
60+
matrix:
61+
tag: ${{ fromJson(needs.get-tags.outputs.tags) }}
3762
steps:
3863
- name: Check out the repo
3964
uses: actions/checkout@v3
65+
with:
66+
ref: ${{ matrix.tag }}
4067

4168
- name: Setup Java and Scala
4269
uses: olafurpg/setup-scala@v13
@@ -79,6 +106,7 @@ jobs:
79106
tags: |
80107
type=ref,event=tag
81108
type=ref,event=branch
109+
type=raw,value=${{ matrix.tag }}
82110
83111
- name: Build and push streampark
84112
uses: docker/build-push-action@v3

0 commit comments

Comments
 (0)