diff --git a/.github/workflows/full-release-pipeline.yml b/.github/workflows/full-release-pipeline.yml index ca3d8ed632..248700a1a0 100644 --- a/.github/workflows/full-release-pipeline.yml +++ b/.github/workflows/full-release-pipeline.yml @@ -2,17 +2,19 @@ name: Full Release Pipeline on: workflow_dispatch: - isProdTrigger: - type: boolean - description: Triggered from prod watcher? - required: true - default: false + inputs: + isProdTrigger: + type: boolean + description: Triggered from prod watcher? + required: true + default: false workflow_call: - isProdTrigger: - type: boolean - description: Triggered from prod watcher? - required: true - default: false + inputs: + isProdTrigger: + type: boolean + description: Triggered from prod watcher? + required: true + default: false jobs: get-version-channel: @@ -20,7 +22,7 @@ jobs: outputs: channel: ${{ steps.getVersion.outputs.channel }} version: ${{ steps.getVersion.outputs.version }} - isProdRelease: ${{ inputs.isProdTrigger && !steps.getVersion.outputs.channel }} + isProdRelease: ${{ fromJSON(inputs.isProdTrigger) && !steps.getVersion.outputs.channel }} steps: - uses: actions/checkout@v3 - id: getVersion @@ -31,10 +33,10 @@ jobs: publish: needs: [get-version-channel] # channel is checked to avoid deploying from a malformed branch - if: needs.get-version-channel.outputs.isProdRelease || (!inputs.isProdTrigger && !!needs.get-version-channel.outputs.channel) + if: fromJSON(needs.get-version-channel.outputs.isProdRelease) || (!fromJSON(inputs.isProdTrigger) && !!needs.get-version-channel.outputs.channel) uses: ./.github/workflows/publish-npm-gh.yml with: - isProdRelease: ${{ needs.get-version-channel.outputs.isProdRelease }} + isProdRelease: ${{ fromJSON(needs.get-version-channel.outputs.isProdRelease) }} secrets: inherit pack-upload: @@ -48,5 +50,5 @@ jobs: uses: ./.github/workflows/promote-release.yml with: version: ${{ needs.get-version-channel.outputs.version }} - isProdRelease: ${{ needs.get-version-channel.outputs.isProdRelease }} + isProdRelease: ${{ fromJSON(needs.get-version-channel.outputs.isProdRelease) }} secrets: inherit diff --git a/.github/workflows/promote-release.yml b/.github/workflows/promote-release.yml index c10832b251..cc6383d846 100644 --- a/.github/workflows/promote-release.yml +++ b/.github/workflows/promote-release.yml @@ -30,7 +30,7 @@ jobs: uses: ./.github/workflows/promote.yml with: version: ${{ inputs.version }} - isProdRelease: ${{ inputs.isProdRelease }} + isProdRelease: ${{ fromJSON(inputs.isProdRelease) }} secrets: inherit ## POST release jobs @@ -52,13 +52,13 @@ jobs: release-homebrew: needs: [ invalidate-cdn-cache ] - if: inputs.isProdRelease + if: fromJSON(inputs.isProdRelease) uses: ./.github/workflows/release-homebrew.yml secrets: inherit change-management: needs: [ promote ] - if: inputs.isProdRelease + if: fromJSON(inputs.isProdRelease) runs-on: ubuntu-latest environment: ChangeManagement env: diff --git a/.github/workflows/promote.yml b/.github/workflows/promote.yml index 9cb6c2a1e2..69967be254 100644 --- a/.github/workflows/promote.yml +++ b/.github/workflows/promote.yml @@ -31,7 +31,7 @@ on: jobs: promote: - name: Promote ${{ inputs.version }} to ${{ inputs.isProdRelease && 'stable' || 'beta' }} + name: Promote ${{ inputs.version }} to ${{ fromJSON(inputs.isProdRelease) && 'stable' || 'beta' }} runs-on: ubuntu-latest env: CLOUDFRONT_DISTRIBUTION: ${{ secrets.CLOUDFRONT_DISTRIBUTION }} @@ -57,7 +57,7 @@ jobs: # get SHA directly from NPM SHA=$(npm view heroku@${{ inputs.version }} --json | jq -r '.gitHead[0:7]') fi - yarn oclif promote --deb --xz --root="./packages/cli" --indexes --version=${{ inputs.version }} --sha="$SHA" --channel=${{ inputs.isProdRelease && 'stable' || 'beta' }} + yarn oclif promote --deb --xz --root="./packages/cli" --indexes --version=${{ inputs.version }} --sha="$SHA" --channel=${{ fromJSON(inputs.isProdRelease) && 'stable' || 'beta' }} shell: bash - name: promote Linux install scripts run: node ./scripts/postrelease/install_scripts.js diff --git a/.github/workflows/publish-npm-gh.yml b/.github/workflows/publish-npm-gh.yml index 8011b0088f..49d7bcc5fd 100644 --- a/.github/workflows/publish-npm-gh.yml +++ b/.github/workflows/publish-npm-gh.yml @@ -39,15 +39,15 @@ jobs: git config user.email "heroku-front-end+npm-releases@salesforce.com" - name: Publish to NPM run: | - if ${{ inputs.isProdRelease }} + if ${{ fromJSON(inputs.isProdRelease) }} then - bash scripts/publish-release + bash scripts/publish-npm-latest else - bash scripts/publish-prerelease + bash scripts/publish-npm-prerelease fi shell: bash - name: Release to Github - if: inputs.isProdRelease + if: fromJSON(inputs.isProdRelease) env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # the script below will fail if run in a separate shell file diff --git a/.github/workflows/watch-for-prerelease.yml b/.github/workflows/watch-for-prerelease.yml index 18e0827a58..17bf2c4154 100644 --- a/.github/workflows/watch-for-prerelease.yml +++ b/.github/workflows/watch-for-prerelease.yml @@ -10,4 +10,4 @@ jobs: uses: ./.github/workflows/full-release-pipeline.yml secrets: inherit with: - isProdTrigger: false + isProdTrigger: ${{ false }} diff --git a/.github/workflows/watch-for-release.yml b/.github/workflows/watch-for-release.yml index 48dd78fbbc..8240b8f9bc 100644 --- a/.github/workflows/watch-for-release.yml +++ b/.github/workflows/watch-for-release.yml @@ -13,4 +13,4 @@ jobs: uses: ./.github/workflows/full-release-pipeline.yml secrets: inherit with: - isProdTrigger: true + isProdTrigger: ${{ true }} diff --git a/scripts/publish-npm-prerelease b/scripts/publish-npm-prerelease index 1d2da1416b..f6c854dbfb 100755 --- a/scripts/publish-npm-prerelease +++ b/scripts/publish-npm-prerelease @@ -10,12 +10,6 @@ if [[ "${CURRENT_BRANCH}" != *"${PRERELEASE_PREFIX}"* ]]; then exit 1 fi -git pull --rebase origin "${CURRENT_BRANCH}" -# The --force overrides local tags. -# This is needed if you've published the CLI previously, -# otherwise git will exit with an error unnecessarily. -git fetch origin --force --tags - PACKAGE_VERSION=`node -e "console.log(require('./lerna.json').version)"` TAG_NAME="v${PACKAGE_VERSION}" EXISTING_REMOTE_TAG=$(git ls-remote origin "refs/tags/${TAG_NAME}")