- Eliminated redundant checksum generation steps in release workflows. - Updated asset validation checks to exclude checksum files and focus solely on archive assets. - Simplified workflow logic for packaging and uploading release artifacts.
Showing the changes to .github (1 of 1 file). Show all
Unified · Split
| @@ -149,24 +149,6 @@ jobs: · 148 unmodified lines | |||
| 149 | else | 149 | else |
| 150 | tar -C "$archive_dir" -czf "dist/$archive_name" "$binary_name" LICENSE README.md README_CN.md config.example.yaml | 150 | tar -C "$archive_dir" -czf "dist/$archive_name" "$binary_name" LICENSE README.md README_CN.md config.example.yaml |
| 151 | fi | 151 | fi |
| 152 | - name: Create asset checksum | ||
| 153 | shell: bash | ||
| 154 | run: | | ||
| 155 | set -euo pipefail | ||
| 156 | shopt -s nullglob | ||
| 157 | archives=(dist/CLIProxyAPI_*.tar.gz dist/CLIProxyAPI_*.zip) | ||
| 158 | if [[ ${#archives[@]} -ne 1 ]]; then | ||
| 159 | printf 'expected one archive, found %s\n' "${#archives[@]}" >&2 | ||
| 160 | printf '%s\n' "${archives[@]}" >&2 | ||
| 161 | exit 1 | ||
| 162 | fi | ||
| 163 | archive="${archives[0]}" | ||
| 164 | archive_name="$(basename "$archive")" | ||
| 165 | if command -v sha256sum >/dev/null 2>&1; then | ||
| 166 | sha256sum "$archive" | awk -v name="$archive_name" '{print $1 " " name}' > "$archive.sha256" | ||
| 167 | else | ||
| 168 | shasum -a 256 "$archive" | awk -v name="$archive_name" '{print $1 " " name}' > "$archive.sha256" | ||
| 169 | fi | ||
| 170 | - uses: actions/upload-artifact@v4 | 152 | - uses: actions/upload-artifact@v4 |
| 171 | with: | 153 | with: |
| 172 | name: ${{ matrix.target }} | 154 | name: ${{ matrix.target }} |
| @@ -179,9 +161,9 @@ jobs: · 6 unmodified lines | |||
| 179 | run: | | 161 | run: | |
| 180 | set -euo pipefail | 162 | set -euo pipefail |
| 181 | shopt -s nullglob | 163 | shopt -s nullglob |
| 182 | assets=(dist/CLIProxyAPI_*.tar.gz dist/CLIProxyAPI_*.zip dist/CLIProxyAPI_*.tar.gz.sha256 dist/CLIProxyAPI_*.zip.sha256) | 164 | assets=(dist/CLIProxyAPI_*.tar.gz dist/CLIProxyAPI_*.zip) |
| 183 | if [[ ${#assets[@]} -lt 2 ]]; then | 165 | if [[ ${#assets[@]} -eq 0 ]]; then |
| 184 | printf 'expected archive and checksum assets, found %s\n' "${#assets[@]}" >&2 | 166 | printf 'expected archive assets, found %s\n' "${#assets[@]}" >&2 |
| 185 | printf '%s\n' "${assets[@]}" >&2 | 167 | printf '%s\n' "${assets[@]}" >&2 |
| 186 | exit 1 | 168 | exit 1 |
| 187 | fi | 169 | fi |
| @@ -302,20 +284,6 @@ jobs: · 114 unmodified lines | |||
| 302 | 284 | ||
| 303 | cp LICENSE README.md README_CN.md config.example.yaml "$archive_dir/" | 285 | cp LICENSE README.md README_CN.md config.example.yaml "$archive_dir/" |
| 304 | tar -C "$archive_dir" -czf "dist/$archive_name" cli-proxy-api LICENSE README.md README_CN.md config.example.yaml | 286 | tar -C "$archive_dir" -czf "dist/$archive_name" cli-proxy-api LICENSE README.md README_CN.md config.example.yaml |
| 305 | - name: Create asset checksum | ||
| 306 | shell: bash | ||
| 307 | run: | | ||
| 308 | set -euo pipefail | ||
| 309 | shopt -s nullglob | ||
| 310 | archives=(dist/CLIProxyAPI_*.tar.gz) | ||
| 311 | if [[ ${#archives[@]} -ne 1 ]]; then | ||
| 312 | printf 'expected one archive, found %s\n' "${#archives[@]}" >&2 | ||
| 313 | printf '%s\n' "${archives[@]}" >&2 | ||
| 314 | exit 1 | ||
| 315 | fi | ||
| 316 | archive="${archives[0]}" | ||
| 317 | archive_name="$(basename "$archive")" | ||
| 318 | sha256sum "$archive" | awk -v name="$archive_name" '{print $1 " " name}' > "$archive.sha256" | ||
| 319 | - uses: actions/upload-artifact@v4 | 287 | - uses: actions/upload-artifact@v4 |
| 320 | with: | 288 | with: |
| 321 | name: ${{ matrix.target }} | 289 | name: ${{ matrix.target }} |
| @@ -328,9 +296,9 @@ jobs: · 6 unmodified lines | |||
| 328 | run: | | 296 | run: | |
| 329 | set -euo pipefail | 297 | set -euo pipefail |
| 330 | shopt -s nullglob | 298 | shopt -s nullglob |
| 331 | assets=(dist/CLIProxyAPI_*.tar.gz dist/CLIProxyAPI_*.tar.gz.sha256) | 299 | assets=(dist/CLIProxyAPI_*.tar.gz) |
| 332 | if [[ ${#assets[@]} -lt 2 ]]; then | 300 | if [[ ${#assets[@]} -eq 0 ]]; then |
| 333 | printf 'expected archive and checksum assets, found %s\n' "${#assets[@]}" >&2 | 301 | printf 'expected archive assets, found %s\n' "${#assets[@]}" >&2 |
| 334 | printf '%s\n' "${assets[@]}" >&2 | 302 | printf '%s\n' "${assets[@]}" >&2 |
| 335 | exit 1 | 303 | exit 1 |
| 336 | fi | 304 | fi |
| @@ -438,20 +406,6 @@ jobs: · 101 unmodified lines | |||
| 438 | 406 | ||
| 439 | cp LICENSE README.md README_CN.md config.example.yaml "$archive_dir/" | 407 | cp LICENSE README.md README_CN.md config.example.yaml "$archive_dir/" |
| 440 | tar -C "$archive_dir" -czf "dist/$archive_name" cli-proxy-api LICENSE README.md README_CN.md config.example.yaml | 408 | tar -C "$archive_dir" -czf "dist/$archive_name" cli-proxy-api LICENSE README.md README_CN.md config.example.yaml |
| 441 | - name: Create asset checksum | ||
| 442 | shell: bash | ||
| 443 | run: | | ||
| 444 | set -euo pipefail | ||
| 445 | shopt -s nullglob | ||
| 446 | archives=(dist/CLIProxyAPI_*.tar.gz) | ||
| 447 | if [[ ${#archives[@]} -ne 1 ]]; then | ||
| 448 | printf 'expected one archive, found %s\n' "${#archives[@]}" >&2 | ||
| 449 | printf '%s\n' "${archives[@]}" >&2 | ||
| 450 | exit 1 | ||
| 451 | fi | ||
| 452 | archive="${archives[0]}" | ||
| 453 | archive_name="$(basename "$archive")" | ||
| 454 | sha256sum "$archive" | awk -v name="$archive_name" '{print $1 " " name}' > "$archive.sha256" | ||
| 455 | - uses: actions/upload-artifact@v4 | 409 | - uses: actions/upload-artifact@v4 |
| 456 | with: | 410 | with: |
| 457 | name: ${{ matrix.target }} | 411 | name: ${{ matrix.target }} |
| @@ -464,9 +418,9 @@ jobs: · 6 unmodified lines | |||
| 464 | run: | | 418 | run: | |
| 465 | set -euo pipefail | 419 | set -euo pipefail |
| 466 | shopt -s nullglob | 420 | shopt -s nullglob |
| 467 | assets=(dist/CLIProxyAPI_*.tar.gz dist/CLIProxyAPI_*.tar.gz.sha256) | 421 | assets=(dist/CLIProxyAPI_*.tar.gz) |
| 468 | if [[ ${#assets[@]} -lt 2 ]]; then | 422 | if [[ ${#assets[@]} -eq 0 ]]; then |
| 469 | printf 'expected archive and checksum assets, found %s\n' "${#assets[@]}" >&2 | 423 | printf 'expected archive assets, found %s\n' "${#assets[@]}" >&2 |
| 470 | printf '%s\n' "${assets[@]}" >&2 | 424 | printf '%s\n' "${assets[@]}" >&2 |
| 471 | exit 1 | 425 | exit 1 |
| 472 | fi | 426 | fi |
| @@ -586,20 +540,6 @@ jobs: · 113 unmodified lines | |||
| 586 | cp "dist/${TARGET}/bin/cli-proxy-api" "$archive_dir/cli-proxy-api" | 540 | cp "dist/${TARGET}/bin/cli-proxy-api" "$archive_dir/cli-proxy-api" |
| 587 | cp LICENSE README.md README_CN.md config.example.yaml "$archive_dir/" | 541 | cp LICENSE README.md README_CN.md config.example.yaml "$archive_dir/" |
| 588 | tar -C "$archive_dir" -czf "dist/$archive_name" cli-proxy-api LICENSE README.md README_CN.md config.example.yaml | 542 | tar -C "$archive_dir" -czf "dist/$archive_name" cli-proxy-api LICENSE README.md README_CN.md config.example.yaml |
| 589 | - name: Create asset checksum | ||
| 590 | shell: bash | ||
| 591 | run: | | ||
| 592 | set -euo pipefail | ||
| 593 | shopt -s nullglob | ||
| 594 | archives=(dist/CLIProxyAPI_*.tar.gz) | ||
| 595 | if [[ ${#archives[@]} -ne 1 ]]; then | ||
| 596 | printf 'expected one archive, found %s\n' "${#archives[@]}" >&2 | ||
| 597 | printf '%s\n' "${archives[@]}" >&2 | ||
| 598 | exit 1 | ||
| 599 | fi | ||
| 600 | archive="${archives[0]}" | ||
| 601 | archive_name="$(basename "$archive")" | ||
| 602 | sha256sum "$archive" | awk -v name="$archive_name" '{print $1 " " name}' > "$archive.sha256" | ||
| 603 | - uses: actions/upload-artifact@v4 | 543 | - uses: actions/upload-artifact@v4 |
| 604 | with: | 544 | with: |
| 605 | name: freebsd-${{ matrix.goarch }} | 545 | name: freebsd-${{ matrix.goarch }} |
| @@ -612,9 +552,9 @@ jobs: · 6 unmodified lines | |||
| 612 | run: | | 552 | run: | |
| 613 | set -euo pipefail | 553 | set -euo pipefail |
| 614 | shopt -s nullglob | 554 | shopt -s nullglob |
| 615 | assets=(dist/CLIProxyAPI_*.tar.gz dist/CLIProxyAPI_*.tar.gz.sha256) | 555 | assets=(dist/CLIProxyAPI_*.tar.gz) |
| 616 | if [[ ${#assets[@]} -lt 2 ]]; then | 556 | if [[ ${#assets[@]} -eq 0 ]]; then |
| 617 | printf 'expected archive and checksum assets, found %s\n' "${#assets[@]}" >&2 | 557 | printf 'expected archive assets, found %s\n' "${#assets[@]}" >&2 |
| 618 | printf '%s\n' "${assets[@]}" >&2 | 558 | printf '%s\n' "${assets[@]}" >&2 |
| 619 | exit 1 | 559 | exit 1 |
| 620 | fi | 560 | fi |