Publish #12
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: Publish | |
on: | |
# This allows us to run this workflow manually from the Actions tab | |
workflow_dispatch: | |
inputs: | |
version-strategy: | |
type: choice | |
description: 'Version strategy' | |
required: true | |
options: | |
- 'patch' | |
- 'minor' | |
- 'major' | |
default: patch | |
title: | |
type: string | |
description: 'Release title' | |
required: true | |
concurrency: | |
group: deploy | |
cancel-in-progress: true | |
jobs: | |
update_package_version: | |
name: Update package version | |
runs-on: ubuntu-latest | |
steps: | |
- name: Notify Slack about new release | |
uses: ravsamhq/notify-slack-action@bca2d7f5660b833a27bda4f6b8bef389ebfefd25 # v2.3.0 | |
with: | |
notification_title: "⏳ Starting new constructor-ui-plp deployment" | |
status: ${{ job.status }} | |
env: | |
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} | |
- uses: actions/checkout@v4 | |
- uses: oleksiyrudenko/gha-git-credentials@ac5b66bcf3873df4259c681d957d8c145980171f # v2.1.1 | |
with: | |
token: '${{ secrets.GITHUB_TOKEN }}' | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: '18.12.x' | |
- name: Install dependencies | |
run: npm ci | |
- name: Get latest release | |
id: last-release | |
uses: pozetroninc/github-action-get-latest-release@d1dafdb6e338bdab109e6afce581a01858680dfb # v0.7.0 | |
with: | |
repository: ${{ github.repository }} | |
excludes: "prerelease, draft" | |
- name: Create new git tag | |
uses: "./.github/actions/create-version-tag" | |
id: tag | |
with: | |
last-version: ${{ steps.last-release.outputs.release }} | |
version-strategy: ${{ inputs.version-strategy }} | |
slack-webhook-url: ${{ secrets.SLACK_WEBHOOK_URL }} | |
outputs: | |
version: ${{ steps.tag.outputs.next-version }} | |
create_github_release: | |
name: Create GitHub release | |
needs: update_package_version | |
uses: ./.github/workflows/create-github-release.yml | |
with: | |
version: ${{ needs.update_package_version.outputs.version }} | |
title: ${{ github.event.inputs.title }} | |
secrets: inherit | |
publish_to_npm: | |
name: Publish to NPM | |
needs: [create_github_release, update_package_version] | |
uses: ./.github/workflows/publish-npm.yml | |
with: | |
version: ${{ needs.update_package_version.outputs.version }} | |
secrets: inherit | |
publish_to_cdn: | |
name: Publish to CDN | |
needs: [publish_to_npm, update_package_version] | |
uses: ./.github/workflows/publish-cdn.yml | |
with: | |
version: ${{ needs.update_package_version.outputs.version }} | |
secrets: inherit | |
deploy_storybook: | |
needs: publish_to_npm | |
name: Deploy Storybook | |
uses: ./.github/workflows/deploy-storybook.yml | |
final_deployment_notification: | |
name: Final deployment notification | |
runs-on: ubuntu-latest | |
if: always() | |
needs: [ | |
create_github_release, | |
publish_to_npm, | |
publish_to_cdn, | |
update_package_version, | |
deploy_storybook | |
] | |
steps: | |
- name: Get workflow conclusion | |
id: workflow-conclusion | |
uses: technote-space/workflow-conclusion-action@45ce8e0eb155657ab8ccf346ade734257fd196a5 # v3.0.3 | |
with: | |
STRICT_SUCCESS: true | |
- name: Report deployment status to Slack | |
uses: ravsamhq/notify-slack-action@v2 | |
with: | |
notification_title: "🏁 Constructor-ui-plp deployment completed" | |
status: ${{ steps.workflow-conclusion.outputs.conclusion }} | |
env: | |
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} |