Skip to content

Fixed mouse joint example version label and used v3. #340

Fixed mouse joint example version label and used v3.

Fixed mouse joint example version label and used v3. #340

name: Trigger site rebuild
on:
push:
branches:
- 'master'
paths:
- '*/*/**'
- '.github/workflows/validate-examples.yml'
- '.github/workflows/trigger-site-rebuild.yml'
- 'validate_examples.py'
- 'build_examples.py'
- 'download_bob.py'
- 'create_archives.py'
jobs:
validate:
runs-on: ubuntu-latest
if: "!contains(github.event.head_commit.message, 'skip-ci')"
steps: [
{ name: 'Checkout', uses: actions/checkout@v4, with: { fetch-depth: 0 } },
{ name: 'Install Python', uses: actions/setup-python@v4, with: { python-version: 3.10.5, architecture: x64 } },
{
name: 'Validate examples',
run: 'python validate_examples.py --changed-from "${{ github.event.before }}" --changed-to "${{ github.sha }}"'
}
]
build:
runs-on: ubuntu-latest
needs: validate
if: "!contains(github.event.head_commit.message, 'skip-ci')"
outputs:
example_count: ${{ steps.count.outputs.example_count }}
changed_examples: ${{ steps.count.outputs.changed_examples }}
steps: [
{ name: 'Checkout', uses: actions/checkout@v4, with: { fetch-depth: 0 } },
{ name: 'Install Python', uses: actions/setup-python@v4, with: { python-version: 3.10.5, architecture: x64 } },
{
name: 'Install Java',
uses: actions/setup-java@v4,
with: { distribution: 'temurin', java-version: '25' }
},
{
name: 'Download Bob',
run: 'python download_bob.py --channel alpha --output bob.jar'
},
{
id: 'count',
name: 'Count touched examples',
env: {
BEFORE_SHA: '${{ github.event.before }}',
AFTER_SHA: '${{ github.sha }}'
},
run: 'echo "example_count=$(python build_examples.py --changed-from "$BEFORE_SHA" --changed-to "$AFTER_SHA" --dry-run)" >> "$GITHUB_OUTPUT"; echo "changed_examples=$(python build_examples.py --changed-from "$BEFORE_SHA" --changed-to "$AFTER_SHA" --list-json)" >> "$GITHUB_OUTPUT"'
},
{
name: 'Build touched examples',
if: steps.count.outputs.example_count != '0',
run: 'python build_examples.py --bob-jar bob.jar --changed-from "${{ github.event.before }}" --changed-to "${{ github.sha }}"'
}
]
publish:
runs-on: ubuntu-latest
needs: build
if: needs.build.outputs.example_count != '0' && !contains(github.event.head_commit.message, 'skip-ci')
steps: [
{ name: 'Checkout', uses: actions/checkout@v4, with: { fetch-depth: 1 } },
{ name: 'Install Python', uses: actions/setup-python@v4, with: { python-version: 3.10.5, architecture: x64 } },
{
name: 'Create archives',
run: 'python create_archives.py'
},
{
name: "Create tag",
run: 'git tag v${{ github.sha }}'
},
{
name: "Push to tag",
run: 'git push origin v${{ github.sha }}'
},
{
name: 'Release',
uses: softprops/action-gh-release@v2,
with: { files: "*.zip", make_latest: true, tag_name: 'v${{ github.sha }}' }
},
{
name: 'Repository dispatch',
env: {
DISPATCH_TOKEN: '${{ secrets.SERVICES_GITHUB_TOKEN }}',
CHANGED_EXAMPLES: '${{ needs.build.outputs.changed_examples }}'
},
run: 'python -c ''import json, os; print(json.dumps({"event_type":"examples","client_payload":{"examples_sha":os.environ["GITHUB_SHA"],"changed_examples":json.loads(os.environ.get("CHANGED_EXAMPLES") or "[]")}}))'' > dispatch.json && curl --fail --request POST --url https://api.github.com/repos/defold/defold.github.io/dispatches --header "Accept: application/vnd.github+json" --header "Authorization: Bearer ${DISPATCH_TOKEN}" --header "X-GitHub-Api-Version: 2022-11-28" --data @dispatch.json'
}
]