diff --git a/.github/workflows/create-cli-release.yml b/.github/workflows/create-cli-release.yml index edd591cccb..f7d0048c0d 100644 --- a/.github/workflows/create-cli-release.yml +++ b/.github/workflows/create-cli-release.yml @@ -55,3 +55,10 @@ jobs: isStableRelease: ${{ fromJSON(needs.get-version-channel.outputs.isStableRelease) }} channel: ${{ needs.get-version-channel.outputs.channel }} secrets: inherit + + publish-docs: + needs: [ promote ] + uses: ./.github/workflows/devcenter-doc-update.yml + with: + isStableRelease: ${{ fromJSON(needs.get-version-channel.outputs.isStableRelease) }} + secrets: inherit diff --git a/.github/workflows/devcenter-doc-update.yml b/.github/workflows/devcenter-doc-update.yml index d750d14939..f57ca41e42 100644 --- a/.github/workflows/devcenter-doc-update.yml +++ b/.github/workflows/devcenter-doc-update.yml @@ -2,17 +2,52 @@ name: Update CLI Command DevCenter Documentation on: workflow_dispatch: + inputs: + isStableRelease: + type: boolean + description: Is this a stable/prod release? + required: true + default: false workflow_call: + inputs: + isStableRelease: + type: boolean + description: Is this a stable/prod release? + required: true + default: false jobs: update-devcenter-command-docs: name: Update Devcenter command docs - runs-on: pub-hk-ubuntu-22.04-small + runs-on: ubuntu-latest + if: fromJSON(inputs.isStableRelease) steps: - uses: actions/checkout@v3 + - name: Use Node.js 16.x + uses: actions/setup-node@v3 + with: + node-version: 16.x + cache: yarn + - name: Install Ruby + uses: ruby/setup-ruby@ec02537da5712d66d4d50a0f33b7eb52773b5ed1 + with: + ruby-version: '3.1' - name: Install package deps run: yarn --immutable --network-timeout 1000000 - name: Install Devcenter CLI run: | gem install devcenter devcenter help + - name: Build CLI + run: yarn build + - name: Compile documentation and push to devcenter + run: | + cd packages/cli + ./scripts/postrelease/dev_center_docs + env: + HEROKU_DEVCENTER_API_KEY: ${{ secrets.HEROKU_DEVCENTER_API_KEY }} + - name: Upload md file as artifact + uses: actions/upload-artifact@v3 + with: + name: heroku-cli-commands + path: /tmp/heroku-cli-commands.md diff --git a/scripts/postrelease/dev_center_docs b/scripts/postrelease/dev_center_docs index 75459baae3..572eaa9ea7 100755 --- a/scripts/postrelease/dev_center_docs +++ b/scripts/postrelease/dev_center_docs @@ -4,15 +4,16 @@ set +x -if [[ -z "${CIRCLE_TAG}" ]]; then +PACKAGE_VERSION=`node -e "console.log(require('./package.json').version)"` + +if [[ "${PACKAGE_VERSION}" == *"-"* ]]; then echo "Not on stable release, skipping devcenter docs update" exit fi -echo "$HEROKU_DEB_SECRET_KEY" | base64 -d | gpg --import cat << EOF > ~/.netrc machine api.heroku.com - login me@example.com + login heroku-cli@salesforce.com password $HEROKU_DEVCENTER_API_KEY EOF chmod 0600 ~/.netrc @@ -21,7 +22,6 @@ set -ex export PATH="./node_modules/.bin:./bin:$PATH" export COLUMNS=80 -yarn run whoami cat < README.md --- @@ -29,11 +29,11 @@ title: Heroku CLI Commands id: 4088 -These are the help texts for each of the core Heroku CLI commands. You can also see this text in your terminal with \`heroku help \`, \`heroku --help\`, or \`heroku -h\`. +These are the help texts for each of the core Heroku CLI commands. You can also see this text in your terminal with \`heroku help\`, \`heroku --help\`, or \`heroku -h\`. EOF oclif readme --no-aliases -grep -v "^\\* \\[\`" README.md | grep -v "^