@@ -217,7 +217,8 @@ jobs:
217217 path : |
218218 build/pkg/rpm/rpmbuild/RPMS/
219219 build/pkg/rpm/rpmbuild/SRPMS/
220- - name : Publish RPM packages to GitHub releases
220+
221+ - name : Publish RPM packages to GitHub releases (latest)
221222 if : github.ref == 'refs/heads/master' || github.ref == 'refs/heads/ci-publish-packages-to-releases'
222223 env :
223224 GH_TOKEN : ${{ github.token }}
@@ -234,3 +235,30 @@ jobs:
234235 mv "$f" "$newf"
235236 gh release upload --clobber ci-latest "$newf"
236237 done
238+
239+ - name : Publish RPM packages to GitHub releases (stable)
240+ if : github.ref == 'refs/heads/ci-release'
241+ env :
242+ GH_TOKEN : ${{ github.token }}
243+ IMAGE_NAME : ${{ matrix.image }}
244+ run : |
245+ curl -sL "$(curl -sL "https://api.github.com/repos/cli/cli/releases" | grep _linux_amd64.tar.gz | grep https | head -n1 | cut -d'"' -f4)" -o gh.tar.gz \
246+ && tar xzf gh.tar.gz \
247+ && find gh*/ -name gh -exec mv {} /usr/local/bin/ \;
248+
249+ git config --global --add safe.directory "$PWD"
250+ latest_tag="$(git tag | grep 'v[0-9]*\.[0-9]*\.[0-9]*' | sort -rn | head -n1)"
251+ if [ ! -z "$latest_tag" ]; then
252+ echo "could not find latest tag"
253+ exit 1
254+ fi
255+ if ! gh release view "$latest_tag"; then
256+ echo "could not find release for tag $latest_tag"
257+ exit 1
258+ fi
259+
260+ find build/ -iname '*.rpm' | while read -r f; do
261+ newf="$IMAGE_NAME-$(basename "$f")"
262+ mv "$f" "$newf"
263+ gh release upload --clobber "$latest_tag" "$newf"
264+ done
0 commit comments