|
5 | 5 | merge_group:
|
6 | 6 |
|
7 | 7 | jobs:
|
8 |
| - ci: |
9 |
| - name: CI |
| 8 | + test: |
| 9 | + name: Test |
10 | 10 | runs-on: ubuntu-latest
|
11 | 11 | if: github.repository == 'rust-lang/team'
|
12 |
| - permissions: |
13 |
| - id-token: write |
14 |
| - pages: write |
15 | 12 | steps:
|
16 | 13 | - uses: actions/checkout@v4
|
17 | 14 | with:
|
@@ -53,23 +50,32 @@ jobs:
|
53 | 50 | run: echo "${{ github.event.pull_request.number }}" > build/pr.txt
|
54 | 51 |
|
55 | 52 | - name: Upload the built JSON as a GitHub artifact
|
56 |
| - if: ${{ github.event_name == 'pull_request' }} |
57 | 53 | uses: actions/upload-artifact@v4
|
58 | 54 | with:
|
59 | 55 | name: team-api-output
|
60 | 56 | path: build
|
61 |
| - |
62 |
| - - name: Disable Jekyll |
63 |
| - run: touch build/.nojekyll |
64 |
| - |
65 |
| - - name: Upload GitHub pages artifact |
66 |
| - uses: actions/upload-pages-artifact@v3 |
| 57 | + deploy: |
| 58 | + name: Deploy |
| 59 | + needs: [ test ] |
| 60 | + runs-on: ubuntu-latest |
| 61 | + environment: deploy |
| 62 | + concurrency: deploy |
| 63 | + permissions: |
| 64 | + id-token: write |
| 65 | + if: github.event_name == 'merge_group' |
| 66 | + steps: |
| 67 | + - name: Download built JSON API |
| 68 | + uses: actions/download-artifact@v4 |
67 | 69 | with:
|
| 70 | + name: team-api-output |
68 | 71 | path: build
|
69 |
| - |
70 | 72 | - name: Deploy to GitHub Pages
|
71 |
| - if: github.event_name == 'merge_group' |
72 |
| - uses: actions/deploy-pages@v4 |
| 73 | + run: | |
| 74 | + touch build/.nojekyll |
| 75 | + curl -LsSf https://raw.githubusercontent.com/rust-lang/simpleinfra/master/setup-deploy-keys/src/deploy.rs | rustc - -o /tmp/deploy |
| 76 | + (cd build && /tmp/deploy) |
| 77 | + env: |
| 78 | + GITHUB_DEPLOY_KEY: ${{ secrets.GITHUB_DEPLOY_KEY }} |
73 | 79 |
|
74 | 80 | - name: Configure AWS credentials
|
75 | 81 | if: github.event_name == 'merge_group'
|
|
85 | 91 | sleep 60
|
86 | 92 | aws --region us-west-1 lambda invoke --function-name start-sync-team output.json
|
87 | 93 | cat output.json | python3 -m json.tool
|
| 94 | +
|
| 95 | + # Summary job for the merge queue. |
| 96 | + # ALL THE PREVIOUS JOBS NEED TO BE ADDED TO THE `needs` SECTION OF THIS JOB! |
| 97 | + conclusion: |
| 98 | + needs: [ test, deploy ] |
| 99 | + # We need to ensure this job does *not* get skipped if its dependencies fail, |
| 100 | + # because a skipped job is considered a success by GitHub. So we have to |
| 101 | + # overwrite `if:`. We use `!cancelled()` to ensure the job does still not get run |
| 102 | + # when the workflow is canceled manually. |
| 103 | + if: ${{ !cancelled() }} |
| 104 | + runs-on: ubuntu-latest |
| 105 | + steps: |
| 106 | + # Manually check the status of all dependencies. `if: failure()` does not work. |
| 107 | + - name: Conclusion |
| 108 | + run: | |
| 109 | + # Print the dependent jobs to see them in the CI log |
| 110 | + jq -C <<< '${{ toJson(needs) }}' |
| 111 | + # Check if all jobs that we depend on (in the needs array) were successful. |
| 112 | + jq --exit-status 'all(.result == "success" or .result == "skipped")' <<< '${{ toJson(needs) }}' |
0 commit comments