|
46 | 46 | DEBIAN_FRONTEND: noninteractive |
47 | 47 |
|
48 | 48 | # Checkout repository -------------------------------------------------------------------- |
49 | | - - uses: actions/checkout@v2 |
| 49 | + - uses: actions/checkout@v4 |
| 50 | + |
| 51 | + # Fix repository permissions |
| 52 | + - name: Fix repository permissions |
| 53 | + run: git config --global --add safe.directory "$PWD" |
| 54 | + |
| 55 | + # Install GitHub CLI |
| 56 | + - name: Install GitHub CLI |
| 57 | + run: .github/workflows/scripts/install-gh-cli.sh |
50 | 58 |
|
51 | 59 | # Checkout release tag (if on release branch) |
52 | 60 | - name: Checkout release tag (if on release branch) |
|
55 | 63 | GH_TOKEN: ${{ github.token }} |
56 | 64 | IMAGE_NAME: ${{ matrix.image }} |
57 | 65 | run: | |
58 | | - git config --global --add safe.directory "$PWD" |
59 | 66 | git fetch --tags |
60 | 67 | latest_tag="$(git tag | grep 'v[0-9]*\.[0-9]*\.[0-9]*' | sort -rn | head -n1)" |
61 | 68 | if [ -z "$latest_tag" ]; then |
@@ -108,37 +115,21 @@ jobs: |
108 | 115 | GH_TOKEN: ${{ github.token }} |
109 | 116 | IMAGE_NAME: ${{ matrix.image }} |
110 | 117 | 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 | | - git config --global --add safe.directory "$PWD" \ |
115 | | - && git tag -f ci-latest HEAD \ |
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 |
| 118 | + git tag -f ci-latest HEAD && git push -f origin tag ci-latest |
| 119 | + TAG_NAME="ci-latest" ./.github/workflows/scripts/upload-packages.sh |
122 | 120 |
|
123 | 121 | - name: Publish DEB packages to GitHub releases (stable) |
124 | 122 | if: github.ref == 'refs/heads/ci-release' |
125 | 123 | env: |
126 | 124 | GH_TOKEN: ${{ github.token }} |
127 | 125 | IMAGE_NAME: ${{ matrix.image }} |
128 | 126 | 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 | 127 | latest_tag="$(git describe --exact-match --tags)" |
133 | 128 | if ! gh release view "$latest_tag"; then |
134 | 129 | echo "could not find release for tag $latest_tag" |
135 | 130 | exit 1 |
136 | 131 | 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 |
| 132 | + TAG_NAME="$latest_tag" ./.github/workflows/scripts/upload-packages.sh |
142 | 133 |
|
143 | 134 | rpm: |
144 | 135 | # Try to build RPM packages |
@@ -211,7 +202,15 @@ jobs: |
211 | 202 | yum -y install rpmdevtools |
212 | 203 |
|
213 | 204 | # Checkout repository -------------------------------------------------------------------- |
214 | | - - uses: actions/checkout@v2 |
| 205 | + - uses: actions/checkout@v4 |
| 206 | + |
| 207 | + # Fix repository permissions |
| 208 | + - name: Fix repository permissions |
| 209 | + run: git config --global --add safe.directory "$PWD" |
| 210 | + |
| 211 | + # Install GitHub CLI |
| 212 | + - name: Install GitHub CLI |
| 213 | + run: .github/workflows/scripts/install-gh-cli.sh |
215 | 214 |
|
216 | 215 | # Checkout release tag (if on release branch) |
217 | 216 | - name: Checkout release tag (if on release branch) |
@@ -286,47 +285,18 @@ jobs: |
286 | 285 | GH_TOKEN: ${{ github.token }} |
287 | 286 | IMAGE_NAME: ${{ matrix.image }} |
288 | 287 | 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 | | - git tag -f ci-latest HEAD |
297 | | - 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 |
| 288 | + git tag -f ci-latest HEAD && git push -f origin tag ci-latest |
| 289 | + TAG_NAME="ci-latest" ./.github/workflows/scripts/upload-packages.sh |
312 | 290 |
|
313 | 291 | - name: Publish RPM packages to GitHub releases (stable) |
314 | 292 | if: github.ref == 'refs/heads/ci-release' |
315 | 293 | env: |
316 | 294 | GH_TOKEN: ${{ github.token }} |
317 | 295 | IMAGE_NAME: ${{ matrix.image }} |
318 | 296 | 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 | 297 | latest_tag="$(git describe --exact-match --tags)" |
323 | 298 | if ! gh release view "$latest_tag"; then |
324 | 299 | echo "could not find release for tag $latest_tag" |
325 | 300 | exit 1 |
326 | 301 | 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 |
| 302 | + TAG_NAME="$latest_tag" ./.github/workflows/scripts/upload-packages.sh |
0 commit comments