Skip to content

make-pr-for-nightly #167

make-pr-for-nightly

make-pr-for-nightly #167

name: make-pr-for-nightly
on:
schedule:
# Daily at:
# 6pm MST
# 7pm MST
# 8pm CST
# 9pm EST
# 11pm ARG
- cron: '0 2 * * *'
workflow_dispatch:
inputs:
only:
type: string
required: false
description: '[--only] comma-separated list, no spaces, of dependencies that you want to bump.'
jobs:
make-pr-for-nightly:
env:
GITHUB_TOKEN: ${{ secrets.SVC_CLI_BOT_GITHUB_TOKEN }}
SF_HIDE_RELEASE_NOTES: true
runs-on: 'ubuntu-latest'
steps:
- name: Check out repository as our bot user
uses: actions/checkout@v3
with:
token: ${{ secrets.SVC_CLI_BOT_GITHUB_TOKEN }}
- name: Set up NodeJS
uses: actions/setup-node@v3
with:
node-version: lts/*
- name: Look up sf latest-rc version
uses: salesforcecli/github-workflows/.github/actions/versionInfo@main
id: latest-rc-version
with:
version: latest-rc
npmPackage: '@salesforce/cli'
- name: Parse latest-rc semver
uses: booxmedialtd/ws-action-parse-semver@e4a833cf5d612066a210bd9b62d1c3b20be3b325
id: latest-rc-semver-info
with:
input_string: ${{ steps.latest-rc-version.outputs.version }}
- name: Look up sf package.json version
uses: notiz-dev/github-action-json-property@2192e246737701f108a4571462b76c75e7376216
id: package-json-version
with:
path: 'package.json'
prop_path: 'version'
- name: Parse package.json semver
uses: booxmedialtd/ws-action-parse-semver@e4a833cf5d612066a210bd9b62d1c3b20be3b325
id: package-json-semver-info
with:
input_string: ${{ steps.package-json-version.outputs.prop }}
- name: Log version info
run: |
echo "INFO | Semver version in 'latest-rc' is ${{ steps.latest-rc-version.outputs.version }}"
echo "INFO | Semver minor in 'latest-rc' is ${{ steps.latest-rc-semver-info.outputs.minor }}"
echo "INFO | Semver version in 'main' is ${{ steps.package-json-version.outputs.prop }}"
echo "INFO | Semver minor in 'main' is ${{ steps.package-json-semver-info.outputs.minor }}"
shell: bash
- name: Install @salesforce/plugin-release-management
run: npm install -g @salesforce/plugin-release-management --omit=dev
- name: Set git config defaults
uses: salesforcecli/github-workflows/.github/actions/gitConfig@main
- name: Fetch all branches
run: git fetch
# --only input using a "ternary-ish": https://github.com/actions/runner/issues/409#issuecomment-752775072
# ${{ x && 'ifTrue' || 'ifFalse' }}
- name: Build nightly PR (minor)
run: sf-release cli:release:build --start-from-github-ref main ${{ inputs.only && format('--only {0}', inputs.only) || '' }} --label nightly-automerge --release-channel nightly
# If the package.json 'minor' IS EQUAL TO the latest-rc 'minor', we want to bump 'minor'
if: ${{ steps.package-json-semver-info.outputs.minor == steps.latest-rc-semver-info.outputs.minor }}
- name: Build nightly PR (patch)
run: sf-release cli:release:build --start-from-github-ref main --patch ${{ inputs.only && format('--only {0}', inputs.only) || '' }} --label nightly-automerge --release-channel nightly
# If the package.json 'minor' IS GREATER THAN the latest-rc 'minor', we want to bump 'patch'
if: ${{ steps.package-json-semver-info.outputs.minor > steps.latest-rc-semver-info.outputs.minor }}