|
1 | 1 | name: Release-plz |
2 | 2 |
|
3 | 3 | on: |
4 | | - workflow_run: |
5 | | - workflows: |
6 | | - - CI |
7 | | - types: |
8 | | - - completed |
9 | | - branches: |
10 | | - - dev |
11 | 4 | push: |
12 | 5 | branches: |
13 | 6 | - main |
|
51 | 44 | config: release-plz.toml |
52 | 45 | env: |
53 | 46 | GITHUB_TOKEN: ${{ github.token }} |
54 | | - |
55 | | - release-ci-gate: |
56 | | - name: Confirm CI checks ran |
57 | | - if: >- |
58 | | - ${{ |
59 | | - github.repository_owner == 'rcore-os' |
60 | | - && github.event_name == 'workflow_run' |
61 | | - && github.event.workflow_run.conclusion == 'success' |
62 | | - && github.event.workflow_run.event == 'push' |
63 | | - && github.event.workflow_run.head_branch == 'dev' |
64 | | - }} |
65 | | - runs-on: ubuntu-latest |
66 | | - permissions: |
67 | | - actions: read |
68 | | - outputs: |
69 | | - ready: ${{ steps.check.outputs.ready }} |
70 | | - steps: |
71 | | - - name: Check CI job results |
72 | | - id: check |
73 | | - uses: actions/github-script@v8 |
74 | | - with: |
75 | | - script: | |
76 | | - const owner = context.repo.owner; |
77 | | - const repo = context.repo.repo; |
78 | | - const run_id = context.payload.workflow_run.id; |
79 | | - const jobs = await github.paginate(github.rest.actions.listJobsForWorkflowRun, { |
80 | | - owner, |
81 | | - repo, |
82 | | - run_id, |
83 | | - per_page: 100, |
84 | | - }); |
85 | | -
|
86 | | - const fmtJobs = jobs.filter((job) => |
87 | | - job.name === "Check formatting" || job.name.startsWith("Check formatting /") |
88 | | - ); |
89 | | - const ready = fmtJobs.some((job) => job.conclusion === "success"); |
90 | | -
|
91 | | - if (!ready) { |
92 | | - core.notice("CI finished successfully without running Check formatting; release publishing will be skipped."); |
93 | | - } |
94 | | -
|
95 | | - core.setOutput("ready", ready ? "true" : "false"); |
96 | | -
|
97 | | - release-plz-release: |
98 | | - name: Publish releases |
99 | | - needs: release-ci-gate |
100 | | - if: >- |
101 | | - ${{ |
102 | | - needs.release-ci-gate.outputs.ready == 'true' |
103 | | - }} |
104 | | - runs-on: ubuntu-latest |
105 | | - concurrency: |
106 | | - group: release-plz-release-${{ github.event.workflow_run.head_branch }} |
107 | | - cancel-in-progress: false |
108 | | - permissions: |
109 | | - contents: write |
110 | | - pull-requests: read |
111 | | - steps: |
112 | | - - name: Checkout code |
113 | | - uses: actions/checkout@v6 |
114 | | - with: |
115 | | - fetch-depth: 0 |
116 | | - ref: ${{ github.event.workflow_run.head_sha }} |
117 | | - persist-credentials: false |
118 | | - |
119 | | - - name: Install Rust toolchain |
120 | | - uses: dtolnay/rust-toolchain@stable |
121 | | - |
122 | | - - name: Run release-plz release |
123 | | - uses: release-plz/action@v0.5 |
124 | | - with: |
125 | | - command: release |
126 | | - config: release-plz.toml |
127 | | - token: ${{ secrets.CARGO_REGISTRY_TOKEN }} |
128 | | - env: |
129 | | - GITHUB_TOKEN: ${{ github.token }} |
130 | | - CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }} |
0 commit comments