11name : Release RC
22
33on :
4- push :
5- branches :
6- - dev
4+ workflow_dispatch :
75
86jobs :
9- state :
10- if : ${{ github.actor == 'github-merge-queue[bot]' }}
11- name : State
12- runs-on : ubuntu-22.04
13- env :
14- GITHUB_TOKEN : ${{ secrets.GH_TOKEN }}
15- outputs :
16- PR : ${{ steps.pull_request.outputs.result }}
17- steps :
18- # # Получаем актуальное состояние dev branch
19- - name : Checkout
20- uses : actions/checkout@v4
21- with :
22- show-progress : false
23- fetch-depth : 0
24-
25- - name : Prepare environment
26- uses : ./.github/actions/prepare-environment
27-
28- # # Получаем информацию о pull request который был влит
29- # # context.sha - это последний commit в dev ветку
30- # # base.sha - это последний commit base branch до влития целевого pull request
31- - name : Get associated pull request by commit
32- id : pull_request
33- uses : actions/github-script@v6
34- with :
35- script : |
36- const teammate = {
37- Yakutoc: "alex_czech",
38- 'neretin-trike': "aaneretin",
39- 'Yeti-or': "yeti-or",
40- TitanKuzmich: "aakrivonos",
41- kayman233: "ivakudryavtsev",
42- shuga2704: "shuga2704",
43- };
44-
45- const res = await github.rest.repos.listPullRequestsAssociatedWithCommit({
46- commit_sha: context.sha,
47- owner: context.repo.owner,
48- repo: context.repo.repo,
49- });
50-
51- const {
52- base: { sha = context.sha },
53- title,
54- user: { login }
55- } = res?.data[0] || {};
56-
57- return { sha, pr: title, user: teammate[login] || 'alex_czech' };
58-
59- # # Сохраняем вывод команды lerna ls в формате json array
60- - name : Preserve lerna ls state
61- id : lerna_ls
62- env :
63- SHA : ${{ fromJSON(steps.pull_request.outputs.result).sha }}
64- run : |
65- echo "RAW_DATA=$(npx lerna la --json --since=${{ env.SHA }} | jq -c)" >> "$GITHUB_OUTPUT"
66-
677 publish :
688 name : Publish RC version
69- needs : [ state ]
70- if : ${{ github.actor == 'github-merge-queue[bot]' }}
719 uses : ./.github/workflows/publish-common.yml
7210 with :
7311 with-update-package-lock : true
@@ -80,44 +18,12 @@ jobs:
8018 catch :
8119 name : Handle errors
8220 runs-on : ubuntu-22.04
83- needs : [ state, publish ]
21+ needs : [ publish ]
8422 if : ${{ always() && contains(needs.*.result, 'failure') }}
85- env :
86- FAILED_JOB_NAME : ${{ contains(needs.change-state.result, 'failure') && 'State' || 'Publish RC version / publish' }}
87- TITLE : ${{ fromJSON(needs.state.outputs.PR).pr }}
88- USER : ${{ fromJSON(needs.state.outputs.PR).user }}
8923 steps :
90- - name : Get failed job information
91- id : job
92- uses : actions/github-script@v6
93- env :
94- RUN_ID : ${{github.run_id}}
95- FAILED_JOB_NAME : ${{ env.FAILED_JOB_NAME }}
96- with :
97- script : |
98- const { RUN_ID, FAILED_JOB_NAME } = process.env;
99-
100- const res = await github.rest.actions.listJobsForWorkflowRun({
101- run_id: RUN_ID,
102- owner: context.repo.owner,
103- repo: context.repo.repo,
104- });
105-
106- const { data: { jobs: jobsList } } = res;
107-
108- const { html_url, steps: stepsList } = jobsList.find(({ name }) => name === FAILED_JOB_NAME ) || {};
109-
110- const { name } = stepsList.find(({ conclusion }) => conclusion === "failure" ) || { name: '' };
111-
112- return { job: html_url, name }
113-
11424 - name : Send notification about failure state
11525 uses : mattermost/action-mattermost-notify@master
11626 with :
11727 MATTERMOST_WEBHOOK_URL : ${{ secrets.WEBHOOKS_NOTIFICATIONS_MM }}
11828 TEXT : |
11929 Публикация RC 💀
120-
121- **PR**: ${{ env.TITLE }}
122- **Failure step**: [${{ fromJSON(steps.job.outputs.result).name }}](${{ fromJSON(steps.job.outputs.result).job }})
123- **Автор**: @${{ env.USER }}
0 commit comments