-
Notifications
You must be signed in to change notification settings - Fork 25
167 lines (156 loc) · 5.95 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
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: actions-ecosystem/action-regex-match@9e6c4fb3d5e898f505be7a1fb6e7b0a278f6665b
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@v3
with:
script: |
core.setFailed('Release channel was not found in release body. Exiting')
- name: Get release channel for s3
id: s3-release-channel
run: |
CHANNEL=${{ steps.release-channel.outputs.group1 }}
S3_CHANNEL=${CHANNEL/latest/stable}
echo "s3-channel=$S3_CHANNEL" >> "$GITHUB_OUTPUT"
- name: Channel Notice
run: |
echo "::notice title=Channel::Channel found in Github Release: ${{ steps.release-channel.outputs.group1 }}"
echo "::notice title=S3 Channel::Channel that will be used in S3: ${{ 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 }}
pack-verify-upload-tarballs:
needs: [get-channel, npm-release]
uses: salesforcecli/github-workflows/.github/workflows/tarballs.yml@main
with:
upload: true
cli: sf
version: ${{ github.event.release.tag_name }}
channel: ${{ needs.get-channel.outputs.s3-channel }}
nodeVersion: ${{ vars.TARBALL_NODE_VERSION }}
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@v3
- uses: actions/setup-node@v3
with:
node-version: lts/*
cache: npm
- 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: nick-fields/retry@943e742917ac94714d2f408a0e8320f2d1fcafcd
with:
max_attempts: 5
retry_wait_seconds: 120
command: sf-release cli:versions:inspect -c ${{ needs.get-channel.outputs.s3-channel }} -l archive --cli sf
retry_on: error
timeout_minutes: 60
pack-upload-mac:
needs: [get-channel, pack-verify-upload-tarballs]
uses: salesforcecli/github-workflows/.github/workflows/packUploadMac.yml@main
with:
cli: sf
version: ${{ github.event.release.tag_name }}
channel: ${{ needs.get-channel.outputs.s3-channel }}
nodeVersion: ${{ vars.TARBALL_NODE_VERSION }}
secrets: inherit
pack-upload-win:
needs: [get-channel, pack-verify-upload-tarballs]
uses: salesforcecli/github-workflows/.github/workflows/packUploadWindows.yml@main
with:
cli: sf
version: ${{ github.event.release.tag_name }}
channel: ${{ needs.get-channel.outputs.s3-channel }}
nodeVersion: ${{ vars.TARBALL_NODE_VERSION }}
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 }}
cli: sf
clipkg: '@salesforce/cli'
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]
env:
SLACK_WEBHOOK_URL: ${{ secrets.PLATFORM_CLI_CHANNEL_SLACK_INCOMING_WEBHOOK }}
SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK
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`"
}
}]
}
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