promote-nightly-to-rc #96
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: promote-nightly-to-rc | |
on: | |
workflow_dispatch: | |
workflow_run: | |
workflows: | |
- promote-rc-to-latest | |
types: | |
- completed | |
jobs: | |
promote: | |
# Only run on 'workflow_dispatch' or if the 'workflow_run' was successful | |
if: ${{ !github.event.workflow_run || github.event.workflow_run.conclusion == 'success' }} | |
uses: ./.github/workflows/promote.yml | |
secrets: inherit | |
with: | |
old-channel: nightly | |
new-channel: latest-rc | |
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 nightly latest-rc | |
- 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 | |
- 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-rc -l archive --cli sf | |
verify-docker-version: | |
needs: [promote-verify] | |
runs-on: ubuntu-latest | |
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: Get docker-full CLI version | |
id: docker-full-version | |
run: | | |
docker pull salesforce/cli:latest-rc-full | |
VERSION=$(docker run --rm salesforce/cli:latest-rc-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-rc-slim | |
VERSION=$(docker run --rm salesforce/cli:latest-rc-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-rc version is: $STEPS_LATEST_RC_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_LATEST_RC_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_LATEST_RC_VERSION_VERSION: ${{ steps.latest-rc-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: | |
needs: [promote-verify, verify-docker-version] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Get nightly version | |
id: nightly-version | |
run: | | |
VERSION=$(npm view @salesforce/cli@nightly --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": ":owl3: `sf` version `${{ steps.nightly-version.outputs.version }}` has been promoted from `nightly` to `latest-rc` :owl3:\nRun `sf whatsnew -v latest-rc` to see what's new" | |
} | |
}] | |
} |