-
Notifications
You must be signed in to change notification settings - Fork 25
181 lines (163 loc) · 6.56 KB
/
create-cli-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
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
name: create-cli-release
on:
release:
# This works for both releases and prereleases https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#release
types: [published]
jobs:
get-channel:
runs-on: ubuntu-latest
outputs:
channel: ${{ steps.release-channel.outputs.group1 }}
s3-channel: ${{ steps.s3-release-channel.outputs.s3-channel }}
steps:
- name: Get release channel Github release
id: release-channel
uses: kaisugi/action-regex-match@45cc5bacf016a4c0d2c3c9d0f8b7c2f1b79687b8
with:
text: ${{ github.event.release.body }}
# https://regex101.com/r/tYAJ8L/1
regex: '!! Release as ([a-z-]+) !!'
- name: Confirm regex channel match
if: ${{ !steps.release-channel.outputs.group1 }}
uses: actions/github-script@v7
with:
script: |
core.setFailed('Release channel was not found in release body. Exiting')
- name: Prevent legacy channel
if: ${{ steps.release-channel.outputs.group1 == 'legacy' }}
uses: actions/github-script@v7
with:
script: |
core.setFailed('Do not publish to the "legacy" channel! It is still bundled with "sfdx@v7", which is permanetly archived.')
- name: Get release channel for s3
id: s3-release-channel
run: |
CHANNEL="$STEPS_RELEASE_CHANNEL_GROUP1"
S3_CHANNEL=${CHANNEL/latest/stable}
echo "s3-channel=$S3_CHANNEL" >> "$GITHUB_OUTPUT"
env:
STEPS_RELEASE_CHANNEL_GROUP1: ${{ steps.release-channel.outputs.group1 }}
- name: Channel Notice
run: |
echo "::notice title=Channel::Channel found in Github Release: $STEPS_RELEASE_CHANNEL_GROUP1"
echo "::notice title=S3 Channel::Channel that will be used in S3: $STEPS_S3_RELEASE_CHANNEL_S3_CHANNEL"
env:
STEPS_RELEASE_CHANNEL_GROUP1: ${{ steps.release-channel.outputs.group1 }}
STEPS_S3_RELEASE_CHANNEL_S3_CHANNEL: ${{ steps.s3-release-channel.outputs.s3-channel }}
npm-release:
uses: salesforcecli/github-workflows/.github/workflows/npmPublish.yml@main
needs: [get-channel]
secrets: inherit
with:
tag: ${{ needs.get-channel.outputs.channel }}
githubTag: ${{ github.event.release.tag_name }}
nodeVersion: ${{ vars.NODE_VERSION_OVERRIDE || 'lts/*' }}
pack-verify-upload-tarballs:
needs: [get-channel, npm-release]
uses: salesforcecli/github-workflows/.github/workflows/tarballs.yml@main
with:
upload: true
version: ${{ github.event.release.tag_name }}
channel: ${{ needs.get-channel.outputs.s3-channel }}
nodeVersion: ${{ vars.NODE_VERSION_OVERRIDE || 'lts/*' }}
secrets: inherit
archives-verify:
# Skip archive-verify on prereleases
if: ${{ contains(fromJSON('["latest", "latest-rc", "nightly"]'), needs.get-channel.outputs.channel) }}
runs-on: ubuntu-latest
needs: [get-channel, pack-verify-upload-tarballs]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: ${{ vars.NODE_VERSION_OVERRIDE || 'lts/*' }}
cache: npm
- name: Install plugin-release-management
run: npm install -g @salesforce/plugin-release-management --omit=dev
# Retry several times because the S3 cache can cause failures
- name: Version inspect (with retries)
uses: salesforcecli/github-workflows/.github/actions/retry@main
with:
max_attempts: 5
retry_wait_seconds: 120
command: sf-release cli:versions:inspect -c ${{ needs.get-channel.outputs.s3-channel }} -l archive
retry_on: error
pack-upload-mac:
needs: [get-channel, pack-verify-upload-tarballs]
uses: salesforcecli/github-workflows/.github/workflows/packUploadMac.yml@main
with:
version: ${{ github.event.release.tag_name }}
channel: ${{ needs.get-channel.outputs.s3-channel }}
nodeVersion: ${{ vars.NODE_VERSION_OVERRIDE || 'lts/*' }}
secrets: inherit
pack-upload-win:
needs: [get-channel, pack-verify-upload-tarballs]
uses: salesforcecli/github-workflows/.github/workflows/packUploadWindows.yml@main
with:
version: ${{ github.event.release.tag_name }}
channel: ${{ needs.get-channel.outputs.s3-channel }}
nodeVersion: ${{ vars.NODE_VERSION_OVERRIDE || 'lts/*' }}
secrets: inherit
stampy-upload-win:
needs: [pack-upload-win]
uses: salesforcecli/github-workflows/.github/workflows/stampyUpload.yml@main
secrets: inherit
with:
version: ${{ github.event.release.tag_name }}
build-docker-slim:
needs: [get-channel, pack-verify-upload-tarballs]
uses: ./.github/workflows/build-docker-slim.yml
with:
version: ${{ github.event.release.tag_name }}
channel: ${{ needs.get-channel.outputs.channel }}
secrets: inherit
build-docker-full:
needs: [get-channel, npm-release]
uses: ./.github/workflows/build-docker-full.yml
with:
version: ${{ github.event.release.tag_name }}
channel: ${{ needs.get-channel.outputs.channel }}
secrets: inherit
announce-cli-patch-in-slack:
# Do not announce prereleases or nightlies
# https://docs.github.com/en/actions/learn-github-actions/expressions#contains
if: ${{ contains(fromJSON('["latest", "latest-rc"]'), needs.get-channel.outputs.channel ) }}
runs-on: ubuntu-latest
needs:
- get-channel
- pack-verify-upload-tarballs
- npm-release
- pack-upload-win
- pack-upload-mac
- build-docker-slim
- build-docker-full
steps:
- name: Announce patch in Slack
uses: slackapi/[email protected]
with:
payload: |
{
"blocks": [{
"type": "section",
"text": {
"type": "mrkdwn",
"text": ":bandaid-4506: `sf@${{ needs.get-channel.outputs.channel }}` has been patched in version `${{ github.event.release.tag_name }}` :bandaid-4506:\nPlease ensure you are running the newest version of `sf`"
}
}]
}
env:
SLACK_WEBHOOK_URL: ${{ secrets.PLATFORM_CLI_CHANNEL_SLACK_INCOMING_WEBHOOK }}
SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK
run-just-nuts:
needs:
- get-channel
- pack-verify-upload-tarballs
- npm-release
- pack-upload-win
- pack-upload-mac
- build-docker-slim
- build-docker-full
uses: ./.github/workflows/just-nuts.yml
with:
channel-or-version: ${{ needs.get-channel.outputs.channel }}
secrets: inherit