|
| 1 | +name: Sync from Aptos Core |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_dispatch: |
| 5 | + |
| 6 | +permissions: |
| 7 | + contents: read |
| 8 | + id-token: write |
| 9 | + |
| 10 | +env: |
| 11 | + GH_TOKEN: ${{ github.token }} |
| 12 | + |
| 13 | +jobs: |
| 14 | + sync: |
| 15 | + runs-on: runs-on,runner=2cpu-linux-x64,run-id=${{ github.run_id }} |
| 16 | + steps: |
| 17 | + # Set up the git credentials for the job (using the aptos-bot personal access token) |
| 18 | + # - uses: oleksiyrudenko/[email protected] |
| 19 | + # with: |
| 20 | + # global: true |
| 21 | + # name: "aptos-bot" |
| 22 | + # token: ${{ secrets.APTOS_BOT_GH_PAT }} |
| 23 | + |
| 24 | + # Reconfigure the git url and credentials such that calling 'git clone <URL>' will work |
| 25 | + # - name: Set github url and credentials |
| 26 | + # run: | |
| 27 | + # /usr/bin/git config --global --add url."https://${{ secrets.APTOS_BOT_GH_PAT }}:x-oauth-basic@github".insteadOf ssh://git@github |
| 28 | + # /usr/bin/git config --global --add url."https://${{ secrets.APTOS_BOT_GH_PAT }}:x-oauth-basic@github".insteadOf https://github |
| 29 | + # /usr/bin/git config --global --add url."https://${{ secrets.APTOS_BOT_GH_PAT }}:x-oauth-basic@github".insteadOf git@github |
| 30 | + |
| 31 | + # Set up the git credentials for the job (using the aptos-bot personal access token) |
| 32 | + - uses: oleksiyrudenko/[email protected] |
| 33 | + with: |
| 34 | + global: true |
| 35 | + token: ${{ secrets.GITHUB_TOKEN }} |
| 36 | + |
| 37 | + # Reconfigure the git url and credentials such that calling 'git clone <URL>' will work |
| 38 | + - name: Set github url and credentials |
| 39 | + run: | |
| 40 | + /usr/bin/git config --global --add url."https://${{ secrets.GITHUB_TOKEN }}:x-oauth-basic@github".insteadOf ssh://git@github |
| 41 | + /usr/bin/git config --global --add url."https://${{ secrets.GITHUB_TOKEN }}:x-oauth-basic@github".insteadOf https://github |
| 42 | + /usr/bin/git config --global --add url."https://${{ secrets.GITHUB_TOKEN }}:x-oauth-basic@github".insteadOf git@github |
| 43 | +
|
| 44 | + - name: Checkout copybara |
| 45 | + uses: actions/checkout@v4 |
| 46 | + with: |
| 47 | + repository: google/copybara |
| 48 | + path: copybara |
| 49 | + |
| 50 | + - uses: bazel-contrib/[email protected] |
| 51 | + with: |
| 52 | + # Avoid downloading Bazel every time. |
| 53 | + bazelisk-cache: true |
| 54 | + # Store build cache per workflow. |
| 55 | + disk-cache: ${{ github.workflow }} |
| 56 | + # Share repository cache between workflows. |
| 57 | + repository-cache: true |
| 58 | + bazelisk-version: 1.x |
| 59 | + |
| 60 | + - name: Build copybara |
| 61 | + working-directory: copybara |
| 62 | + run: | |
| 63 | + set -x |
| 64 | + bazel build //java/com/google/copybara:copybara_deploy.jar |
| 65 | + cp bazel-bin/java/com/google/copybara/copybara_deploy.jar /usr/local/bin/ |
| 66 | + cat <<'EOF' > /usr/local/bin/copybara |
| 67 | + #!/bin/bash -e |
| 68 | +
|
| 69 | + java -jar /usr/local/bin/copybara_deploy.jar "$@" |
| 70 | + EOF |
| 71 | +
|
| 72 | + chmod +x /usr/local/bin/copybara |
| 73 | +
|
| 74 | + - name: Run copybara |
| 75 | + run: | |
| 76 | + copybara |
| 77 | +
|
0 commit comments