diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 27ed4c66f7..2c09e8ba09 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -8,6 +8,12 @@ on: - '*' pull_request: workflow_dispatch: + inputs: + alpha_build: + description: 'Publish as Clover-Build-Alpha rolling_release' + required: false + default: true + type: boolean jobs: build-macos: @@ -15,6 +21,9 @@ jobs: runs-on: macos-latest permissions: contents: write + concurrency: + group: ${{ ((github.event_name == 'workflow_dispatch' && inputs.alpha_build == true) || (github.event_name == 'push' && github.ref == 'refs/heads/master')) && 'clover-alpha-release' || format('build-{0}', github.run_id) }} + cancel-in-progress: false steps: - uses: actions/checkout@v7 with: @@ -60,7 +69,20 @@ jobs: CLOVERX64.efi.zip Clover_r*.pkg - - name: Publish Release + - name: Verify Release Assets + run: | + shopt -s nullglob + missing=() + for pattern in '*.7z' 'CloverV2*.zip' 'CLOVERX64.efi.zip' 'Clover_r*.pkg'; do + files=($pattern) + if [ ${#files[@]} -eq 0 ]; then missing+=("$pattern"); fi + done + if [ ${#missing[@]} -gt 0 ]; then + echo "::error::Missing expected release artifact(s): ${missing[*]}" + exit 1 + fi + + - name: Publish Tagged Release if: startsWith(github.ref, 'refs/tags/') uses: softprops/action-gh-release@v3 with: @@ -70,3 +92,45 @@ jobs: CLOVERX64.efi.zip Clover_r*.pkg generate_release_notes: true + prerelease: ${{ contains(github.ref_name, 'alpha') || contains(github.ref_name, 'beta') }} + + - name: Publish Alpha Rolling Release + if: (github.event_name == 'workflow_dispatch' && inputs.alpha_build == true) || (github.event_name == 'push' && github.ref == 'refs/heads/master') + uses: softprops/action-gh-release@v3 + with: + tag_name: Clover-Build-Alpha + name: "Clover Build Alpha (${{ env.GIT_SHA }})" + body: | + Automated alpha build from commit `${{ env.GIT_SHA }}` on branch `${{ github.ref_name }}`. + This is a rolling pre-release and will be overwritten by future alpha builds. + files: | + *.7z + CloverV2*.zip + CLOVERX64.efi.zip + Clover_r*.pkg + generate_release_notes: false + prerelease: true + make_latest: false + + - name: Remove Stale Alpha Release Assets + if: (github.event_name == 'workflow_dispatch' && inputs.alpha_build == true) || (github.event_name == 'push' && github.ref == 'refs/heads/master') + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + if ! gh release view Clover-Build-Alpha >/dev/null 2>&1; then + echo "Clover-Build-Alpha release does not exist yet; skipping asset cleanup." + exit 0 + fi + + shopt -s nullglob + current=(*.7z CloverV2*.zip CLOVERX64.efi.zip Clover_r*.pkg) + gh release view Clover-Build-Alpha --json assets --jq '.assets[].name' | + while IFS= read -r asset; do + keep=false + for f in "${current[@]}"; do + if [ "$f" = "$asset" ]; then keep=true; break; fi + done + if [ "$keep" = false ]; then + gh release delete-asset Clover-Build-Alpha "$asset" --yes + fi + done diff --git a/README.md b/README.md index da74457e10..4da0f547ea 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,7 @@ # CloverBootloader -[![CI](https://github.com/CloverHackyColor/CloverBootloader/actions/workflows/main.yml/badge.svg)](https://github.com/CloverHackyColor/CloverBootloader/actions/workflows/main.yml) [![License](https://img.shields.io/badge/License-BSD%202--Clause-orange.svg)](https://github.com/CloverHackyColor/CloverBootloader/blob/master/LICENSE) +[![CI](https://github.com/CloverHackyColor/CloverBootloader/actions/workflows/main.yml/badge.svg)](https://github.com/CloverHackyColor/CloverBootloader/actions/workflows/main.yml) [![License](https://img.shields.io/badge/License-BSD%202--Clause-orange.svg)](https://github.com/CloverHackyColor/CloverBootloader/blob/master/LICENSE) [![Latest Release](https://img.shields.io/github/v/release/CloverHackyColor/CloverBootloader?style=flat&label=Latest%20Release)](https://github.com/CloverHackyColor/CloverBootloader/releases/latest) +[![Version](https://img.shields.io/github/v/tag/CloverHackyColor/CloverBootloader?filter=Clover-Build-Alpha*&style=flat&label=Version&cacheSeconds=60)](https://github.com/CloverHackyColor/CloverBootloader/releases) CloverLogo