|
| 1 | +name: CI |
| 2 | + |
| 3 | +on: |
| 4 | + # Check for updates every 6 hours |
| 5 | + schedule: |
| 6 | + - cron: '0 */6 * * *' |
| 7 | + |
| 8 | + # Manual trigger with optional SHA override |
| 9 | + workflow_dispatch: |
| 10 | + inputs: |
| 11 | + webkit_sha: |
| 12 | + description: 'WebKit commit SHA to build (leave empty for latest main)' |
| 13 | + required: false |
| 14 | + default: '' |
| 15 | + force_build: |
| 16 | + description: 'Force build even if release exists' |
| 17 | + required: false |
| 18 | + default: 'false' |
| 19 | + type: boolean |
| 20 | + llvm_version: |
| 21 | + description: 'LLVM version' |
| 22 | + default: '19' |
| 23 | + |
| 24 | +jobs: |
| 25 | + check: |
| 26 | + name: Check for Updates |
| 27 | + runs-on: ubuntu-latest |
| 28 | + outputs: |
| 29 | + should_build: ${{ steps.check.outputs.should_build }} |
| 30 | + webkit_sha: ${{ steps.check.outputs.webkit_sha }} |
| 31 | + release_tag: ${{ steps.check.outputs.release_tag }} |
| 32 | + steps: |
| 33 | + - name: Get latest WebKit SHA |
| 34 | + id: get_sha |
| 35 | + run: | |
| 36 | + if [ -n "${{ inputs.webkit_sha }}" ]; then |
| 37 | + SHA="${{ inputs.webkit_sha }}" |
| 38 | + else |
| 39 | + SHA=$(git ls-remote https://github.com/oven-sh/WebKit.git refs/heads/main | cut -f1) |
| 40 | + fi |
| 41 | + echo "sha=$SHA" >> $GITHUB_OUTPUT |
| 42 | + echo "Latest WebKit SHA: $SHA" |
| 43 | +
|
| 44 | + - name: Check if release exists |
| 45 | + id: check |
| 46 | + env: |
| 47 | + GH_TOKEN: ${{ github.token }} |
| 48 | + run: | |
| 49 | + SHA="${{ steps.get_sha.outputs.sha }}" |
| 50 | + RELEASE_TAG="autobuild-$SHA" |
| 51 | + |
| 52 | + echo "webkit_sha=$SHA" >> $GITHUB_OUTPUT |
| 53 | + echo "release_tag=$RELEASE_TAG" >> $GITHUB_OUTPUT |
| 54 | + |
| 55 | + # Check if release already exists |
| 56 | + if [ "${{ inputs.force_build }}" = "true" ]; then |
| 57 | + echo "Force build requested" |
| 58 | + echo "should_build=true" >> $GITHUB_OUTPUT |
| 59 | + elif gh release view "$RELEASE_TAG" --repo ${{ github.repository }} > /dev/null 2>&1; then |
| 60 | + echo "Release $RELEASE_TAG already exists, skipping build" |
| 61 | + echo "should_build=false" >> $GITHUB_OUTPUT |
| 62 | + else |
| 63 | + echo "Release $RELEASE_TAG does not exist, triggering build" |
| 64 | + echo "should_build=true" >> $GITHUB_OUTPUT |
| 65 | + fi |
| 66 | +
|
| 67 | + build: |
| 68 | + name: Build and Release |
| 69 | + needs: check |
| 70 | + if: needs.check.outputs.should_build == 'true' |
| 71 | + permissions: |
| 72 | + contents: write |
| 73 | + uses: ./.github/workflows/build-reusable.yml |
| 74 | + with: |
| 75 | + webkit_sha: ${{ needs.check.outputs.webkit_sha }} |
| 76 | + release_tag: ${{ needs.check.outputs.release_tag }} |
| 77 | + is_prerelease: false |
| 78 | + llvm_version: ${{ inputs.llvm_version || '19' }} |
| 79 | + |
0 commit comments