-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
## Changes - Update deploy workflow >AS-IS: A tag creation triggers the self-service deploy workflow. >TO-BE: A merge event triggers the self-service deploy workflow. ticket: [SECURE-601] [SECURE-601]: https://sendbird.atlassian.net/browse/SECURE-601?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ
- Loading branch information
Showing
4 changed files
with
70 additions
and
12 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,11 @@ orbs: | |
aws-cli: circleci/[email protected] | ||
aws-s3: circleci/[email protected] | ||
|
||
parameters: | ||
run_deploy_prod: | ||
type: boolean | ||
default: false | ||
|
||
executors: | ||
ci-aws: | ||
docker: | ||
|
@@ -104,6 +109,9 @@ jobs: | |
# Publish - build self-service | ||
build: | ||
executor: node | ||
parameters: | ||
widget_version: | ||
type: string | ||
steps: | ||
- checkout | ||
- run: | ||
|
@@ -114,7 +122,7 @@ jobs: | |
command: | | ||
cd ./packages/self-service | ||
npm install | ||
npm run build version=${CIRCLE_TAG} | ||
npm run build version=<< parameters.widget_version >> | ||
# TODO: update self-service to use yarn workspaces | ||
# yarn install --immutable --immutable-cache | ||
# yarn build | ||
|
@@ -174,27 +182,33 @@ workflows: | |
- run-test: | ||
requires: | ||
- prepare | ||
deploy_to_s3: | ||
|
||
deploy_prod: | ||
when: << pipeline.parameters.run_deploy_prod >> | ||
jobs: | ||
- build: | ||
name: build | ||
filters: &only_version_tag_trigger | ||
tags: | ||
only: /^v\d+\.\d+\.\d+$/ | ||
widget_version: "" | ||
filters: &default_branch_trigger | ||
branches: | ||
ignore: /.*/ | ||
only: | ||
- develop | ||
- upload_to_s3_and_invalidate_cache: | ||
name: upload_to_s3_and_invalidate_cache | ||
filters: *only_version_tag_trigger | ||
filters: *default_branch_trigger | ||
s3_bucket: $S3_BUCKET | ||
distribution_id: $DISTRIBUTION_ID | ||
role_arn: $ROLE_ARN | ||
requires: | ||
- build | ||
context: | ||
- circleci-dashboard-bot | ||
|
||
deploy_stg: | ||
jobs: | ||
- build: | ||
name: build_staging | ||
widget_version: $CIRCLE_TAG | ||
filters: &only_version_tag_trigger_staging | ||
tags: | ||
only: /^v\d+\.\d+\.\d+-staging(\.\d+)?$/ | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
name: self-service build and publish | ||
|
||
env: | ||
DEFAULT_BRANCH: develop | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- ${{ env.DEFAULT_BRANCH }} | ||
types: | ||
- closed | ||
|
||
jobs: | ||
deploy: | ||
if: github.event.pull_request.merged == true | ||
runs-on: ubuntu-latest | ||
env: | ||
CIRCLECI_TOKEN: ${{ secrets.CIRCLECI_API_TOKEN }} | ||
DEFAULT_BRANCH: ${{ env.DEFAULT_BRANCH }} | ||
steps: | ||
- name: Check if the source branch is a release branch | ||
run: | | ||
PR_BRANCH="${{ github.event.pull_request.head.ref }}" | ||
echo "Source branch is $PR_BRANCH" | ||
if [[ "$PR_BRANCH" == release/* ]]; then | ||
echo "The source branch is a release branch, proceed with deployment." | ||
curl -d '{\"branch\": \"${DEFAULT_BRANCH}\", \"parameters\": {\"run_deploy_prod\": true}}' \ | ||
-H 'Content-Type: application/json' \ | ||
-H 'Circle-Token: ${CIRCLECI_TOKEN}' \ | ||
-X POST https://circleci.com/api/v2/project/gh/sendbird/chat-ai-widget/pipeline | ||
else | ||
echo "The source branch is not a release branch, skipping deployment." | ||
exit 0 | ||
fi |
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
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