Fixed scaling issue in the revolute bridge example #344
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Trigger site rebuild | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| full_rebuild: | |
| description: 'Validate, build, archive, and publish all examples' | |
| required: false | |
| default: true | |
| type: boolean | |
| 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: "github.event_name != 'push' || !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', | |
| env: { | |
| BEFORE_SHA: '${{ github.event.before }}', | |
| AFTER_SHA: '${{ github.sha }}', | |
| FULL_REBUILD: '${{ github.event_name == ''workflow_dispatch'' && inputs.full_rebuild }}' | |
| }, | |
| run: 'if [ "$FULL_REBUILD" = "true" ]; then python validate_examples.py; else python validate_examples.py --changed-from "$BEFORE_SHA" --changed-to "$AFTER_SHA"; fi' | |
| } | |
| ] | |
| build: | |
| runs-on: ubuntu-latest | |
| needs: validate | |
| if: "github.event_name != 'push' || !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 }}', | |
| FULL_REBUILD: '${{ github.event_name == ''workflow_dispatch'' && inputs.full_rebuild }}' | |
| }, | |
| run: 'if [ "$FULL_REBUILD" = "true" ]; then echo "example_count=$(python build_examples.py --dry-run)" >> "$GITHUB_OUTPUT"; echo "changed_examples=$(python build_examples.py --list-json)" >> "$GITHUB_OUTPUT"; else 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"; fi' | |
| }, | |
| { | |
| name: 'Build touched examples', | |
| if: steps.count.outputs.example_count != '0', | |
| env: { | |
| BEFORE_SHA: '${{ github.event.before }}', | |
| AFTER_SHA: '${{ github.sha }}', | |
| FULL_REBUILD: '${{ github.event_name == ''workflow_dispatch'' && inputs.full_rebuild }}' | |
| }, | |
| run: 'if [ "$FULL_REBUILD" = "true" ]; then python build_examples.py --bob-jar bob.jar; else python build_examples.py --bob-jar bob.jar --changed-from "$BEFORE_SHA" --changed-to "$AFTER_SHA"; fi' | |
| } | |
| ] | |
| publish: | |
| runs-on: ubuntu-latest | |
| needs: build | |
| if: "needs.build.outputs.example_count != '0' && (github.event_name != 'push' || !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' | |
| } | |
| ] |