|
46 | 46 | DEBIAN_FRONTEND: noninteractive |
47 | 47 |
|
48 | 48 | # Checkout repository -------------------------------------------------------------------- |
49 | | - - uses: actions/checkout@v2 |
| 49 | + - uses: actions/checkout@v4 |
| 50 | + |
| 51 | + # Install GitHub CLI |
| 52 | + - name: Install GitHub CLI |
| 53 | + run: .github/workflow/scripts/install-gh-cli.sh |
50 | 54 |
|
51 | 55 | # Checkout release tag (if on release branch) |
52 | 56 | - name: Checkout release tag (if on release branch) |
|
55 | 59 | GH_TOKEN: ${{ github.token }} |
56 | 60 | IMAGE_NAME: ${{ matrix.image }} |
57 | 61 | run: | |
58 | | - git config --global --add safe.directory "$PWD" |
59 | 62 | git fetch --tags |
60 | 63 | latest_tag="$(git tag | grep 'v[0-9]*\.[0-9]*\.[0-9]*' | sort -rn | head -n1)" |
61 | 64 | if [ -z "$latest_tag" ]; then |
@@ -108,37 +111,23 @@ jobs: |
108 | 111 | GH_TOKEN: ${{ github.token }} |
109 | 112 | IMAGE_NAME: ${{ matrix.image }} |
110 | 113 | run: | |
111 | | - 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 \ |
112 | | - && tar xzf gh.tar.gz \ |
113 | | - && find gh*/ -name gh -exec mv {} /usr/local/bin/ \; |
114 | 114 | git config --global --add safe.directory "$PWD" \ |
115 | 115 | && git tag -f ci-latest HEAD \ |
116 | 116 | && git push -f origin tag ci-latest |
117 | | - find build/ -iname '*.deb' | while read -r f; do |
118 | | - newf="$IMAGE_NAME-$(basename "$f")" |
119 | | - mv "$f" "$newf" |
120 | | - gh release upload --clobber ci-latest "$newf" |
121 | | - done |
| 117 | + TAG_NAME="ci-latest" ./.github/workflows/scripts/upload-packages.sh |
122 | 118 |
|
123 | 119 | - name: Publish DEB packages to GitHub releases (stable) |
124 | 120 | if: github.ref == 'refs/heads/ci-release' |
125 | 121 | env: |
126 | 122 | GH_TOKEN: ${{ github.token }} |
127 | 123 | IMAGE_NAME: ${{ matrix.image }} |
128 | 124 | run: | |
129 | | - 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 \ |
130 | | - && tar xzf gh.tar.gz \ |
131 | | - && find gh*/ -name gh -exec mv {} /usr/local/bin/ \; |
132 | 125 | latest_tag="$(git describe --exact-match --tags)" |
133 | 126 | if ! gh release view "$latest_tag"; then |
134 | 127 | echo "could not find release for tag $latest_tag" |
135 | 128 | exit 1 |
136 | 129 | fi |
137 | | - find build/ -iname '*.deb' | while read -r f; do |
138 | | - newf="$IMAGE_NAME-$(basename "$f")" |
139 | | - mv "$f" "$newf" |
140 | | - gh release upload --clobber "$latest_tag" "$newf" |
141 | | - done |
| 130 | + TAG_NAME="$latest_tag" ./.github/workflows/scripts/upload-packages.sh |
142 | 131 |
|
143 | 132 | rpm: |
144 | 133 | # Try to build RPM packages |
@@ -211,7 +200,11 @@ jobs: |
211 | 200 | yum -y install rpmdevtools |
212 | 201 |
|
213 | 202 | # Checkout repository -------------------------------------------------------------------- |
214 | | - - uses: actions/checkout@v2 |
| 203 | + - uses: actions/checkout@v4 |
| 204 | + |
| 205 | + # Install GitHub CLI |
| 206 | + - name: Install GitHub CLI |
| 207 | + run: .github/workflow/scripts/install-gh-cli.sh |
215 | 208 |
|
216 | 209 | # Checkout release tag (if on release branch) |
217 | 210 | - name: Checkout release tag (if on release branch) |
@@ -286,47 +279,19 @@ jobs: |
286 | 279 | GH_TOKEN: ${{ github.token }} |
287 | 280 | IMAGE_NAME: ${{ matrix.image }} |
288 | 281 | run: | |
289 | | - set -x |
290 | | -
|
291 | | - 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 \ |
292 | | - && tar xzf gh.tar.gz \ |
293 | | - && find gh*/ -name gh -exec mv {} /usr/local/bin/ \; |
294 | | -
|
295 | | - git config --global --add safe.directory "$PWD" |
296 | 282 | git tag -f ci-latest HEAD |
297 | 283 | git push -f origin tag ci-latest |
298 | | -
|
299 | | - IFS=$'\n' |
300 | | - set +e; assets="$(gh release view ci-latest | grep '^asset:' | cut -f2 | grep -F "${IMAGE_NAME//:/.}")"; set -e |
301 | | - files="$(find build/ -iname '*.rpm')" |
302 | | - for f in $files; do |
303 | | - newf="$IMAGE_NAME-$(basename "$f")" |
304 | | - mv "$f" "$newf" |
305 | | - gh release upload --clobber ci-latest "$newf" |
306 | | - set +e; assets="$(grep -vF "${newf//:/.}" <<<"$assets")"; set -e |
307 | | - done |
308 | | -
|
309 | | - for asset in $assets; do |
310 | | - gh release delete-asset ci-latest "$asset" |
311 | | - done |
| 284 | + TAG_NAME="ci-latest" ./.github/workflows/scripts/upload-packages.sh |
312 | 285 |
|
313 | 286 | - name: Publish RPM packages to GitHub releases (stable) |
314 | 287 | if: github.ref == 'refs/heads/ci-release' |
315 | 288 | env: |
316 | 289 | GH_TOKEN: ${{ github.token }} |
317 | 290 | IMAGE_NAME: ${{ matrix.image }} |
318 | 291 | run: | |
319 | | - 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 \ |
320 | | - && tar xzf gh.tar.gz \ |
321 | | - && find gh*/ -name gh -exec mv {} /usr/local/bin/ \; |
322 | 292 | latest_tag="$(git describe --exact-match --tags)" |
323 | 293 | if ! gh release view "$latest_tag"; then |
324 | 294 | echo "could not find release for tag $latest_tag" |
325 | 295 | exit 1 |
326 | 296 | fi |
327 | | -
|
328 | | - find build/ -iname '*.rpm' | while read -r f; do |
329 | | - newf="$IMAGE_NAME-$(basename "$f")" |
330 | | - mv "$f" "$newf" |
331 | | - gh release upload --clobber "$latest_tag" "$newf" |
332 | | - done |
| 297 | + TAG_NAME="$latest_tag" ./.github/workflows/scripts/upload-packages.sh |
0 commit comments