mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-11-05 17:43:23 -08:00
Add "auto-publishing of betas" job
This commit is contained in:
parent
7a41dfe175
commit
cb9bcb4789
1 changed files with 47 additions and 6 deletions
53
.github/workflows/desktop-build.yml
vendored
53
.github/workflows/desktop-build.yml
vendored
|
|
@ -46,6 +46,7 @@ jobs:
|
||||||
outputs:
|
outputs:
|
||||||
tag: ${{ steps.configure.outputs.tag }}
|
tag: ${{ steps.configure.outputs.tag }}
|
||||||
sha: ${{ steps.configure.outputs.sha }}
|
sha: ${{ steps.configure.outputs.sha }}
|
||||||
|
is_beta: ${{ steps.prepare.outputs.is_beta }}
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: "Configure"
|
- name: "Configure"
|
||||||
|
|
@ -85,13 +86,20 @@ jobs:
|
||||||
body_path: ${{ steps.prepare.outputs.body_path }}
|
body_path: ${{ steps.prepare.outputs.body_path }}
|
||||||
prerelease: ${{ steps.prepare.outputs.is_beta }}
|
prerelease: ${{ steps.prepare.outputs.is_beta }}
|
||||||
run: |
|
run: |
|
||||||
args=()
|
if gh release view "$tag_name" >/dev/null 2>&1; then
|
||||||
[[ $prerelease == yes ]] && args+=(--prerelease)
|
echo "Release $tag_name already exists; leaving it unchanged."
|
||||||
|
else
|
||||||
|
args=()
|
||||||
|
[[ $prerelease == yes ]] && args+=(--prerelease)
|
||||||
|
|
||||||
gh release create "$tag_name" --verify-tag --draft "${args[@]}" \
|
gh release create "$tag_name" \
|
||||||
--target "$target" \
|
--verify-tag \
|
||||||
--title "$release_name" \
|
--draft \
|
||||||
--notes-file "$body_path"
|
"${args[@]}" \
|
||||||
|
--target "$target" \
|
||||||
|
--title "$release_name" \
|
||||||
|
--notes-file "$body_path"
|
||||||
|
fi
|
||||||
|
|
||||||
build-linux:
|
build-linux:
|
||||||
strategy:
|
strategy:
|
||||||
|
|
@ -570,3 +578,36 @@ jobs:
|
||||||
BUILD_PATH: ${{ steps.build.outputs.path }}
|
BUILD_PATH: ${{ steps.build.outputs.path }}
|
||||||
GH_TOKEN: ${{ github.token }}
|
GH_TOKEN: ${{ github.token }}
|
||||||
run: gh attestation verify "$BUILD_PATH" --repo Cockatrice/Cockatrice
|
run: gh attestation verify "$BUILD_PATH" --repo Cockatrice/Cockatrice
|
||||||
|
|
||||||
|
publish:
|
||||||
|
name: Publish pre-release automatically
|
||||||
|
runs-on: ubuntu-slim # https://github.com/actions/runner-images/blob/main/images/ubuntu-slim/ubuntu-slim-Readme.md
|
||||||
|
needs:
|
||||||
|
- configure
|
||||||
|
- build-linux
|
||||||
|
- build-vcpkg
|
||||||
|
if: ${{ github.ref_type == 'tag' && needs.configure.outputs.is_beta == 'yes' }}
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: "Publish pre-release"
|
||||||
|
shell: bash
|
||||||
|
env:
|
||||||
|
GH_TOKEN: ${{ github.token }}
|
||||||
|
tag_name: ${{ needs.configure.outputs.tag }}
|
||||||
|
run: |
|
||||||
|
release=$(gh release view "$tag_name" --json isDraft,isPrerelease)
|
||||||
|
|
||||||
|
is_draft=$(jq -r '.isDraft' <<< "$release")
|
||||||
|
is_prerelease=$(jq -r '.isPrerelease' <<< "$release")
|
||||||
|
|
||||||
|
if [[ "$is_draft" != true ]]; then
|
||||||
|
echo "::error::Release $tag_name is not a draft; refusing to publish it."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ "$is_prerelease" != true ]]; then
|
||||||
|
echo "::error::Release $tag_name is not a prerelease; refusing to publish it."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
gh release edit "$tag_name" --draft=false
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue