-
Notifications
You must be signed in to change notification settings - Fork 20
76 lines (65 loc) · 2.1 KB
/
publish-latest.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
name: Release
on:
push:
branches:
- master
concurrency:
# New commit on branch cancels running workflows of the same branch
group: ${{ github.workflow }}-${{ github.head_ref }}
cancel-in-progress: true
jobs:
publish:
name: Release
uses: ./.github/workflows/publish-common.yml
with:
with-update-package-lock: true
auto-options: '--no-changelog'
secrets:
gh_token: ${{ secrets.GH_TOKEN }}
npm_registry_token: ${{ secrets.NPM_REGISTRY_TOKEN }}
changelog:
runs-on: ubuntu-latest
needs: [publish]
if: ${{ always() && contains(needs.publish.result, 'success') }}
env:
GITHUB_TOKEN: ${{ secrets.gh_token }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
show-progress: false
fetch-depth: 0
ref: master
- name: Get associated pull request by commit
id: data
uses: actions/github-script@v7
with:
result-encoding: string
script: |
const res = await github.rest.repos.listPullRequestsAssociatedWithCommit({
commit_sha: context.sha,
owner: context.repo.owner,
repo: context.repo.repo,
});
const data = res?.data[0].body || '';
return data;
- name: Install dependencies
run: |
cd .github/actions/write-changelog
npm ci
- name: Write changelog
uses: ./.github/actions/write-changelog
with:
data: ${{ steps.data.outputs.result }}
- name: Extract branch name
id: branch
shell: bash
run: echo "BRANCH=$(echo ${GITHUB_REF#refs/heads/})" >> $GITHUB_OUTPUT
- name: Commit & Push changelog files
uses: actions-js/push@master
with:
github_token: ${{ secrets.gh_token }}
message: 'chore: Update CHANGELOG.md [skip ci]'
branch: ${{ steps.branch.outputs.BRANCH }}
author_name: Salute Frontend Team
author_email: [email protected]