This repository has been archived by the owner on Jul 31, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
141 lines (126 loc) · 4.44 KB
/
release.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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
name: Test and Release
on:
push:
branches:
- main
concurrency: ${{ github.workflow }}-${{ github.ref }}
jobs:
publish_to_npm:
name: Publishing to npm registry
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@v3
- name: Setup Node.js 18.x
uses: actions/[email protected]
with:
node-version: 18.x
- name: Install pnpm
run: corepack enable && corepack prepare [email protected] --activate
- name: Create Release Pull Request or Publish to npm
id: changesets
uses: changesets/action@v1
with:
publish: pnpm run release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Get current date
id: date
run: echo "::set-output name=date::$(date +'%B %d, %Y')"
- name: extract-changelogs
if: steps.changesets.outputs.published == 'true'
id: change-logs
uses: vikas-cldcvr/[email protected]
with:
released-package-versions: ${{ steps.changesets.outputs.publishedPackages }}
changelog-files-config: |
{
"@cldcvr/flow-log":"packages/flow-log/CHANGELOG.md",
"@cldcvr/flow-code-editor":"packages/flow-code-editor/CHANGELOG.md",
"@cldcvr/flow-md-editor":"packages/flow-md-editor/CHANGELOG.md",
"@cldcvr/flow-core":"packages/flow-core/CHANGELOG.md",
"@cldcvr/flow-table":"packages/flow-table/CHANGELOG.md",
"@cldcvr/flow-core-config":"packages/flow-core-config/CHANGELOG.md",
"@cldcvr/flow-form-builder":"packages/flow-form-builder/CHANGELOG.md",
"@cldcvr/flow-lineage":"packages/flow-lineage/CHANGELOG.md",
"@cldcvr/custom-elements-manifest-to-types":"packages/custom-elements-manifest-to-types/CHANGELOG.md"
}
- name: Send Slack Notification
if: steps.changesets.outputs.published == 'true'
id: slack
uses: slackapi/[email protected]
with:
# For posting a rich message using Block Kit
payload: |
{
"text": "Updates",
"blocks": [
{
"type": "header",
"text": {
"type": "plain_text",
"text": ":mega: Flow Announcement"
}
},
{
"type": "context",
"elements": [
{
"text": "*${{ steps.date.outputs.date }}* | New Release Alert",
"type": "mrkdwn"
}
]
},
{
"type": "divider"
},
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "Hello everyone!\nPlease find below the changelogs"
}
},
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": ${{ toJSON(steps.change-logs.outputs.changeLogs) }}
}
}
]
}
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK
publish_to_github:
name: Publishing to github registry
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@v2
- name: Setup Node.js 18.x
uses: actions/[email protected]
with:
node-version: 18.x
- name: Install pnpm
run: corepack enable && corepack prepare [email protected] --activate
- name: Replace publish URL
run: node replace-publish-config.js https://npm.pkg.github.com
- name: Creating .npmrc
run: |
cat << EOF > "$HOME/.npmrc"
//npm.pkg.github.com/:_authToken=$NPM_TOKEN
EOF
env:
NPM_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Create Release Pull Request or Publish to github
id: changesets
uses: changesets/action@v1
with:
publish: pnpm run release --no-git-tag
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}