|
| 1 | +name: V8 Upgrade |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_dispatch: |
| 5 | + schedule: |
| 6 | + - cron: '0 3 * * *' # Run every day |
| 7 | + |
| 8 | +permissions: |
| 9 | + pull-requests: write |
| 10 | + contents: write |
| 11 | + |
| 12 | +jobs: |
| 13 | + upgrade: |
| 14 | + name: Upgrade V8 |
| 15 | + runs-on: ubuntu-22.04 |
| 16 | + outputs: |
| 17 | + v8_version: ${{ steps.check_version.outputs.NEW_V8_VERSION }} |
| 18 | + steps: |
| 19 | + - name: Checkout |
| 20 | + uses: actions/checkout@v4 |
| 21 | + with: |
| 22 | + submodules: false |
| 23 | + fetch-depth: 0 |
| 24 | + |
| 25 | + - uses: actions/setup-python@v5 |
| 26 | + with: |
| 27 | + python-version: '3.8' |
| 28 | + |
| 29 | + - name: Run upgrade script |
| 30 | + id: check_version |
| 31 | + working-directory: ./deps |
| 32 | + run: ./v8_upgrade.sh |
| 33 | + |
| 34 | + build: |
| 35 | + name: Build V8 for ${{ matrix.platform }} ${{ matrix.arch }} |
| 36 | + runs-on: ${{ matrix.platform }} |
| 37 | + needs: upgrade |
| 38 | + if: needs.upgrade.outputs.v8_version != '0' |
| 39 | + strategy: |
| 40 | + fail-fast: true |
| 41 | + matrix: |
| 42 | + platform: [ubuntu-22.04, macos-latest] |
| 43 | + arch: [x64, arm64] |
| 44 | + steps: |
| 45 | + - name: Checkout |
| 46 | + uses: actions/checkout@v4 |
| 47 | + with: |
| 48 | + submodules: true |
| 49 | + clean: true |
| 50 | + fetch-depth: 1 |
| 51 | + |
| 52 | + - name: Update version file |
| 53 | + shell: bash |
| 54 | + run: echo -n "${{ needs.upgrade.outputs.v8_version }}" > deps/VERSION |
| 55 | + |
| 56 | + - name: Build Release for Linux |
| 57 | + if: startsWith(matrix.platform, 'ubuntu') |
| 58 | + uses: ./.github/actions/build-linux |
| 59 | + with: |
| 60 | + target-arch: ${{ matrix.arch }} |
| 61 | + |
| 62 | + - name: Build Release for macOS |
| 63 | + if: startsWith(matrix.platform, 'macos') |
| 64 | + uses: ./.github/actions/build-macos |
| 65 | + with: |
| 66 | + target-arch: ${{ matrix.arch }} |
| 67 | + |
| 68 | + - name: Set v8 build name |
| 69 | + working-directory: ./deps |
| 70 | + shell: bash |
| 71 | + run: | |
| 72 | + target_arch="$1" |
| 73 | + os=$(echo "$(uname -s)" | tr '[:upper:]' '[:lower:]') |
| 74 | + archive_name="v8_${os}_${{ matrix.arch }}" |
| 75 | + echo "Using Archive Name: $archive_name" |
| 76 | + echo "ARCHIVE_NAME=$archive_name" >> "$GITHUB_ENV" |
| 77 | +
|
| 78 | + - name: Upload Artifact |
| 79 | + uses: actions/upload-artifact@v4 |
| 80 | + with: |
| 81 | + name: ${{ env.ARCHIVE_NAME }} |
| 82 | + path: deps/v8/out/release/obj/libv8_monolith.a |
| 83 | + retention-days: 1 |
| 84 | + |
| 85 | + release: |
| 86 | + name: Release V8 |
| 87 | + runs-on: ubuntu-22.04 |
| 88 | + needs: |
| 89 | + - upgrade |
| 90 | + - build |
| 91 | + if: needs.upgrade.outputs.v8_version != '0' |
| 92 | + steps: |
| 93 | + - name: Checkout |
| 94 | + uses: actions/checkout@v4 |
| 95 | + with: |
| 96 | + submodules: true |
| 97 | + clean: true |
| 98 | + fetch-depth: 1 |
| 99 | + |
| 100 | + - name: Download Archives |
| 101 | + uses: actions/download-artifact@v4 |
| 102 | + with: |
| 103 | + path: artifact |
| 104 | + |
| 105 | + - name: Display Downloads |
| 106 | + run: ls -lhR artifact |
| 107 | + |
| 108 | + - name: Copy artifacts to correct folders |
| 109 | + shell: bash |
| 110 | + run: | |
| 111 | + rm deps/darwin_x86_64/libv8.a |
| 112 | + rm deps/darwin_arm64/libv8.a |
| 113 | + rm deps/linux_x86_64/libv8.a |
| 114 | + rm deps/linux_arm64/libv8.a |
| 115 | +
|
| 116 | + cp artifact/v8_darwin_x64/libv8_monolith.a deps/darwin_x86_64/libv8.a |
| 117 | + cp artifact/v8_darwin_arm64/libv8_monolith.a deps/darwin_arm64/libv8.a |
| 118 | + cp artifact/v8_linux_x64/libv8_monolith.a deps/linux_x86_64/libv8.a |
| 119 | + cp artifact/v8_linux_arm64/libv8_monolith.a deps/linux_arm64/libv8.a |
| 120 | +
|
| 121 | + rm -rf artifact |
| 122 | +
|
| 123 | + - name: Update version file |
| 124 | + shell: bash |
| 125 | + run: echo -n "${{ needs.upgrade.outputs.v8_version }}" > deps/VERSION |
| 126 | + |
| 127 | + - name: Download V8 Source |
| 128 | + shell: bash |
| 129 | + working-directory: ./deps |
| 130 | + run: ./v8_download.sh |
| 131 | + |
| 132 | + - name: Ensure includes and files are up to date |
| 133 | + shell: bash |
| 134 | + run: ./deps/v8_upgrade.py ${{ needs.upgrade.outputs.v8_version }} |
| 135 | + |
| 136 | + - name: Create PR |
| 137 | + uses: peter-evans/create-pull-request@v7 |
| 138 | + with: |
| 139 | + commit-message: "Upgrade V8 binaries for ${{ needs.upgrade.outputs.v8_version }} version" |
| 140 | + branch: "v8_${{ needs.upgrade.outputs.v8_version }}_upgrade" |
| 141 | + delete-branch: true |
| 142 | + title: "Upgrade V8 binaries for ${{ needs.upgrade.outputs.v8_version }} version" |
| 143 | + body: "Auto-generated pull request to upgrade V8 binary for ${{ needs.upgrade.outputs.v8_version }} version" |
0 commit comments