Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 42 additions & 0 deletions .github/workflows/sync-samples-on-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Sync Samples On Release

on:
release:
types:
- published
- prereleased

permissions:
contents: read

jobs:
sync-samples:
runs-on: ubuntu-latest
Comment on lines +13 to +14

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Gate sample dispatch on release-version verification

When a semantic-version release tag disagrees with the tagged revision's VERSION, verify-release-version.yml now fails independently while this job still posts engine-released to the samples repository. The previous needs: verify-release-version dependency prevented that invalid release from updating samples; keep dispatch failures non-blocking, but retain the version-match gate before sending the event.

Useful? React with 👍 / 👎.

env:
RELEASE_TAG: ${{ github.event.release.tag_name }}
SAMPLES_REPOSITORY: ${{ vars.LENGA_SAMPLES_REPOSITORY || 'lengaengine/example-games' }}
SAMPLES_REPOSITORY_TOKEN: ${{ secrets.SAMPLES_REPOSITORY_TOKEN }}
steps:
- name: Dispatch released version to samples when configured
shell: bash
run: |
set -euo pipefail

if [[ -z "$SAMPLES_REPOSITORY_TOKEN" ]]; then
echo '::notice::Skipping sample synchronization because SAMPLES_REPOSITORY_TOKEN is not configured.'
exit 0
fi

VERSION="${RELEASE_TAG#v}"
if [[ ! "$VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+(-[0-9A-Za-z.-]+)?$ ]]; then
echo "::warning::Skipping sample synchronization because '$RELEASE_TAG' is not a supported semantic version."
exit 0
fi

if ! GH_TOKEN="$SAMPLES_REPOSITORY_TOKEN" gh api \
--method POST \
"repos/$SAMPLES_REPOSITORY/dispatches" \
--raw-field event_type=engine-released \
--raw-field "client_payload[version]=$VERSION"; then
echo "::warning::Could not notify $SAMPLES_REPOSITORY. The engine release remains valid."
fi
31 changes: 0 additions & 31 deletions .github/workflows/verify-release-version.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,34 +42,3 @@ jobs:
echo "VERSION mismatch: tag is '$VERSION_TAG' but VERSION contains '$FILE_VERSION'." >&2
exit 1
fi

notify-samples:
if: ${{ github.event_name == 'release' }}
needs: verify-release-version
runs-on: ubuntu-latest
env:
RELEASE_TAG: ${{ github.event.release.tag_name }}
SAMPLES_REPOSITORY: ${{ vars.LENGA_SAMPLES_REPOSITORY || 'lengaengine/example-games' }}
SAMPLES_REPOSITORY_TOKEN: ${{ secrets.SAMPLES_REPOSITORY_TOKEN }}
steps:
- name: Dispatch released version to samples
shell: bash
run: |
set -euo pipefail

if [[ -z "$SAMPLES_REPOSITORY_TOKEN" ]]; then
echo 'SAMPLES_REPOSITORY_TOKEN is required to synchronize public samples.' >&2
exit 1
fi

VERSION="${RELEASE_TAG#v}"
if [[ ! "$VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+(-[0-9A-Za-z.-]+)?$ ]]; then
echo "Release tag '$RELEASE_TAG' is not a supported semantic version." >&2
exit 1
fi

GH_TOKEN="$SAMPLES_REPOSITORY_TOKEN" gh api \
--method POST \
"repos/$SAMPLES_REPOSITORY/dispatches" \
--raw-field event_type=engine-released \
--raw-field "client_payload[version]=$VERSION"
Loading