@@ -3,12 +3,37 @@ name: GenRepositoryISO
33on :
44 push :
55 tags :
6- - ' iso-* '
6+ - ' iso-latest '
77 workflow_dispatch :
88
99jobs :
10+ update-tag :
11+ name : Update iso-latest Tag
12+ runs-on : ubuntu-latest
13+ if : github.repository == 'kubesphere/kubekey' && (github.event_name == 'push' || github.event_name == 'workflow_dispatch')
14+ steps :
15+ - name : Checkout
16+ uses : actions/checkout@v6
17+
18+ - name : Check or update iso-latest tag
19+ shell : bash
20+ run : |
21+ CURRENT_TAG_SHA=$(git rev-parse iso-latest 2>/dev/null || echo "")
22+ LATEST_MAIN_SHA=$(git rev-parse origin/main)
23+
24+ if [ "$CURRENT_TAG_SHA" = "$LATEST_MAIN_SHA" ]; then
25+ echo "Tag is already up-to-date, skipping update"
26+ else
27+ echo "Updating iso-latest tag to latest main commit ($LATEST_MAIN_SHA)"
28+ git tag -d iso-latest 2>/dev/null || true
29+ git tag -f iso-latest origin/main
30+ git push origin :refs/tags/iso-latest 2>/dev/null || true
31+ git push origin --tags
32+ fi
33+
1034 build-iso :
1135 runs-on : ubuntu-latest
36+ needs : update-tag
1237 if : github.repository == 'kubesphere/kubekey'
1338 strategy :
1439 fail-fast : false
4166 steps :
4267 - name : Checkout
4368 uses : actions/checkout@v6
69+ with :
70+ ref : iso-latest
71+ fetch-depth : 0
4472
4573 - name : Set up QEMU
4674 uses : docker/setup-qemu-action@v3
@@ -63,16 +91,18 @@ jobs:
6391 mv ./output/linux_arm64/*.iso ${{ matrix.name }}-arm64.iso
6492 sha256sum *.iso > ${{ matrix.name }}.iso.sha256sum.txt
6593
66- - name : Release and upload packages
67- if : startsWith(github.ref, 'refs/tags/')
94+ - name : Release and upload ISO packages
6895 uses : softprops/action-gh-release@v2
6996 env :
7097 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
7198 with :
99+ tag_name : iso-latest
100+ name : iso-latest
72101 files : |
73102 ${{ matrix.name }}.iso.sha256sum.txt
74103 ${{ matrix.name }}-amd64.iso
75104 ${{ matrix.name }}-arm64.iso
105+ overwrite : true
76106
77107 - name : Synchronize artifacts to OSS
78108 run : |
@@ -85,19 +115,23 @@ jobs:
85115 echo "access_key_id: ${{secrets.KS_QSCTL_ACCESS_KEY_ID}}" > qsctl-config.yaml
86116 echo "secret_access_key: ${{ secrets.KS_QSCTL_SECRET_ACCESS_KEY }}" >> qsctl-config.yaml
87117
88- qsctl -c qsctl-config.yaml cp ${{ matrix.name }}.iso.sha256sum.txt qs://kubekey/kubesphere/kubekey/releases/download/iso-latest/${{ steps.prepare.outputs.version }} /${{ matrix.name }}.iso.sha256sum.txt
89- qsctl -c qsctl-config.yaml cp ${{ matrix.name }}-amd64.iso qs://kubekey/kubesphere/kubekey/releases/download/iso-latest/${{ steps.prepare.outputs.version }} /${{ matrix.name }}-amd64.iso
90- qsctl -c qsctl-config.yaml cp ${{ matrix.name }}-arm64.iso qs://kubekey/kubesphere/kubekey/releases/download/iso-latest/${{ steps.prepare.outputs.version }} /${{ matrix.name }}-arm64.iso
118+ qsctl -c qsctl-config.yaml cp ${{ matrix.name }}.iso.sha256sum.txt qs://kubekey/github.com/ kubesphere/kubekey/releases/download/iso-latest/${{ matrix.name }}.iso.sha256sum.txt
119+ qsctl -c qsctl-config.yaml cp ${{ matrix.name }}-amd64.iso qs://kubekey/github.com/ kubesphere/kubekey/releases/download/iso-latest/${{ matrix.name }}-amd64.iso
120+ qsctl -c qsctl-config.yaml cp ${{ matrix.name }}-arm64.iso qs://kubekey/github.com/ kubesphere/kubekey/releases/download/iso-latest/${{ matrix.name }}-arm64.iso
91121
92122 rm -rf qsctl-config.yaml
93123
94124
95125 build-harbor :
96126 runs-on : ubuntu-latest
127+ needs : update-tag
97128 if : github.repository == 'kubesphere/kubekey'
98129 steps :
99130 - name : Checkout
100131 uses : actions/checkout@v6
132+ with :
133+ ref : iso-latest
134+ fetch-depth : 0
101135 - shell : bash
102136 name : build arm harbor
103137 run : |
@@ -117,11 +151,12 @@ jobs:
117151 fi
118152 done
119153
120- - name : Create GitHub Release & Upload Assets
121- uses : ncipollo/release-action@v1
154+ - name : Release and upload harbor packages
155+ uses : softprops/action-gh-release@v2
156+ env :
157+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
122158 with :
123- tag_name : ${{ github.ref_name }}
124- name : ${{ github.ref_name }}
125- artifacts : config/harbor/*/*harbor-offline-installer*.tgz
126- allowUpdates : true
127- replaceArtifacts : true
159+ tag_name : iso-latest
160+ name : iso-latest
161+ files : config/harbor/*/*harbor-offline-installer*.tgz
162+ overwrite : true
0 commit comments