-
Notifications
You must be signed in to change notification settings - Fork 25
117 lines (104 loc) · 4.17 KB
/
promote-rc-to-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
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
name: promote-rc-to-latest
on:
workflow_dispatch:
schedule:
# Wednesdays 1pm central
- cron: '0 18 * * 3'
jobs:
promote:
uses: ./.github/workflows/promote.yml
secrets: inherit
with:
old-channel: latest-rc
new-channel: latest
use-ctc: true
promote-verify:
runs-on: ubuntu-latest
needs: [promote]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: ${{ vars.NODE_VERSION_OVERRIDE || 'lts/*' }}
cache: yarn
- name: Verify promote scripts
uses: salesforcecli/github-workflows/.github/actions/retry@main
with:
max_attempts: 5
retry_wait_seconds: 120
command: ./scripts/verify-promote latest-rc latest
- name: Install plugin-release-management
uses: salesforcecli/github-workflows/.github/actions/retry@main
with:
max_attempts: 5
retry_wait_seconds: 120
command: 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 stable -l archive --cli sf
verify-docker-version:
needs: [promote-verify]
runs-on: ubuntu-latest
steps:
- name: Get latest version
id: latest-version
run: |
VERSION=$(npm view @salesforce/cli@latest --json | jq -r '.version')
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
- name: Get docker-full CLI version
id: docker-full-version
run: |
docker pull salesforce/cli:latest-full
VERSION=$(docker run --rm salesforce/cli:latest-full sf version --json | jq -r '.cliVersion' | cut -d'/' -f 3)
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
- name: Get docker-slim CLI version
id: docker-slim-version
run: |
docker pull salesforce/cli:latest-slim
VERSION=$(docker run --rm salesforce/cli:latest-slim sf version --json | jq -r '.cliVersion' | cut -d'/' -f 3)
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
- name: Compare Docker versions against npm
run: |
echo "[INFO] NPM latest version is: $STEPS_LAST_VERSION_VERSION"
echo "[INFO] Docker-full version is: $STEPS_DOCKER_FULL_VERSION_VERSION"
echo "[INFO] Docker-slim version is: $STEPS_DOCKER_SLIM_VERSION_VERSION"
if [ "$STEPS_LAST_VERSION_VERSION" == "$STEPS_DOCKER_FULL_VERSION_VERSION" ] && [ "$STEPS_DOCKER_FULL_VERSION_VERSION" == "$STEPS_DOCKER_SLIM_VERSION_VERSION" ]; then
echo "Docker versions match npm version. Proceeding..."
else
echo "Version mismatch! Exiting..."
exit 1
fi
env:
STEPS_LAST_VERSION_VERSION: ${{ steps.latest-version.outputs.version }}
STEPS_DOCKER_FULL_VERSION_VERSION: ${{ steps.docker-full-version.outputs.version }}
STEPS_DOCKER_SLIM_VERSION_VERSION: ${{ steps.docker-slim-version.outputs.version }}
announce-promotion-to-slack:
runs-on: ubuntu-latest
needs: [promote-verify, verify-docker-version]
steps:
- name: Get latest-rc version
id: latest-rc-version
run: |
VERSION=$(npm view @salesforce/cli@latest-rc --json | jq -r '.version')
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
- name: Announce promotion
id: 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": ":rocket: `sf` version `${{ steps.latest-rc-version.outputs.version }}` has been promoted from `latest-rc` to `latest` :rocket:\nRun `sf whatsnew -v latest` to see what's new"
}
}]
}