Skip to content

Commit

Permalink
#28259 Deployment setup to trigger sdk-libs publishing.
Browse files Browse the repository at this point in the history
  • Loading branch information
dcolina committed Aug 2, 2024
1 parent f588e0d commit b5768fc
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 6 deletions.
5 changes: 5 additions & 0 deletions .github/workflows/build-test-master.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ on:
description: 'Run all tests'
type: boolean
default: false
publish-npm-sdk-libs:
description: 'Publish NPM SDKs'
type: boolean
default: false
jobs:
initialize:
name: Initialize
Expand Down Expand Up @@ -75,6 +79,7 @@ jobs:
with:
artifact-run-id: ${{ needs.initialize.outputs.artifact-run-id }}
environment: trunk
publish-npm-sdk-libs: ${{ (needs.initialize.outputs.sdk_libs == 'true' && github.event_name != 'workflow_dispatch') || (inputs.publish-npm-sdks && github.event_name == 'workflow_dispatch') }}
secrets:
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
DOCKER_TOKEN: ${{ secrets.DOCKER_TOKEN }}
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/build-test-nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ on:
type: boolean
description: 'Indicates if the workflow should build on missing artifacts'
default: true
publish-npm-package:
publish-npm-cli:
type: boolean
description: 'Indicates if the workflow should publish the NPM package on the registry'
default: false
Expand Down Expand Up @@ -65,7 +65,7 @@ jobs:
artifact-run-id: ${{ needs.initialize.outputs.artifact-run-id }}
environment: nightly
deploy-dev-image: true
publish-npm-package: ${{ ( github.event_name == 'workflow_dispatch' && inputs.publish-npm-package == true ) || github.event_name == 'schedule' }}
publish-npm-cli: ${{ ( github.event_name == 'workflow_dispatch' && inputs.publish-npm-cli == true ) || github.event_name == 'schedule' }}
reuse-previous-build: ${{ inputs.reuse-previous-build || false }}
secrets:
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
Expand Down
37 changes: 33 additions & 4 deletions .github/workflows/reusable-deployment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,12 @@ on:
reuse-previous-build:
default: false
type: boolean
publish-npm-package:
publish-npm-cli:
default: false
type: boolean
publish-npm-sdk-libs:
default: false
type: boolean
secrets:
DOCKER_USERNAME:
required: false
Expand Down Expand Up @@ -101,16 +104,22 @@ jobs:
artifactory-password: ${{ secrets.EE_REPO_PASSWORD }}
github-token: ${{ secrets.GITHUB_TOKEN }}


- name: CLI Publish
id: cli_publish
if: inputs.publish-npm-package
if: inputs.publish-npm-cli
uses: ./.github/actions/publish-npm-cli
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
npm-token: ${{ secrets.NPM_ORG_TOKEN }}
cli-artifact-run-id: ${{ github.run_id }} # currently cli artifacts are never from build queue

- name: SDKs Publish
id: sdks_publish
if: inputs.publish-npm-sdk-libs
uses: ./.github/actions/publish-npm-sdk-libs
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
npm-token: ${{ secrets.NPM_ORG_TOKEN }}

# A Slack notification is sent using the 'slackapi/slack-github-action' action if the repository is 'dotcms/core'.
- name: Slack Notification (Docker image announcement)
Expand All @@ -134,7 +143,7 @@ jobs:
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}

- name: Slack Notification (dotCLI announcement)
if: inputs.publish-npm-package
if: inputs.publish-npm-cli
uses: slackapi/[email protected]
with:
channel-id: "log-dotcli"
Expand All @@ -152,3 +161,23 @@ jobs:
}
env:
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}

- name: Slack Notification (SDK libs announcement)
if: inputs.publish-npm-sdk-libs
uses: slackapi/[email protected]
with:
channel-id: "log-sdk-libs"
payload: |
{
"blocks": [
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "> :large_orange_circle: *Attention dotters:* SDK libs (Angular, Client, Experiments and React) published!\n \n>This automated script is happy to announce that a new *_SDK libs_* version *tagged as:* [ `${{ steps.sdks_publish.outputs.npm-package-version }}` ] is now available on the `NPM` registry :package:!"
}
}
]
}
env:
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
2 changes: 2 additions & 0 deletions .github/workflows/reusable-initialize.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ on:
value: ${{ jobs.changes.outputs.jvm_unit_test }}
cli:
value: ${{ jobs.changes.outputs.cli }}
sdk_libs:
value: ${{ jobs.changes.outputs.sdk_libs }}
jobs:
initialize: # This is used as a required check to indicate that the workflow has started and is running
name: Initialize
Expand Down

0 comments on commit b5768fc

Please sign in to comment.