-
Notifications
You must be signed in to change notification settings - Fork 125
Add Slack Integration and Update Publish Process (@W-7953925) #110
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,15 @@ version: 2.1 | |
orbs: | ||
win: circleci/windows@2.2.0 | ||
sfchangecase: salesforce/change-case-management@3 | ||
slack: circleci/slack@3.4.2 | ||
|
||
parameters: | ||
publish: | ||
type: boolean | ||
default: false | ||
publish-type: | ||
type: string | ||
default: patch | ||
|
||
_refs: | ||
defaults: &defaults | ||
|
@@ -107,9 +116,13 @@ jobs: | |
shell: bash.exe | ||
- store_test_results: | ||
path: test-results | ||
release: | ||
publish: | ||
<<: *defaults | ||
steps: | ||
- slack/notify: | ||
channel: 'pdt_releases' | ||
color: '#FFDEAD' | ||
message: 'Starting Publish for SDR Library' | ||
- add_ssh_keys: *ssh-config | ||
- checkout | ||
- restore_cache: *restore_cache | ||
|
@@ -127,10 +140,12 @@ jobs: | |
- run: | ||
name: Bump package version | ||
command: | | ||
yarn version --patch --no-git-tag-version | ||
yarn version --<< pipeline.parameters.publish-type >> --no-git-tag-version | ||
git add package.json | ||
export RELEASE_TAG="$(node -pe "require('./package.json').version")" | ||
git commit -m "[skip ci] Updated version $RELEASE_TAG" | ||
echo "export RELEASE_VERSION=$RELEASE_TAG" >> $BASH_ENV | ||
source $BASH_ENV | ||
git commit -m "Updated version $RELEASE_TAG" | ||
- run: | ||
name: Set .npmrc | ||
command: echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > ~/.npmrc | ||
|
@@ -139,16 +154,24 @@ jobs: | |
- run: | ||
name: Tag the release and push to repo | ||
command: | | ||
export RELEASE_TAG="$(node -pe "require('./package.json').version")" | ||
git tag v${RELEASE_TAG} | ||
git tag v${RELEASE_VERSION} | ||
git push --tags | ||
- sfchangecase/update: | ||
location: REPO_LOCATION | ||
release: GUS_RELEASE | ||
- slack/notify: | ||
channel: 'pdt_releases' | ||
color: '#9bcd9b' | ||
message: 'SDR Library v${RELEASE_VERSION} has been published to npm' | ||
- slack/status: | ||
channel: 'pdt_releases' | ||
fail_only: true | ||
|
||
workflows: | ||
version: 2 | ||
'deploy-and-retrieve': | ||
version: 2.1 | ||
|
||
commit-workflow: | ||
unless: << pipeline.parameters.publish >> | ||
jobs: | ||
- node-latest | ||
- node-12 | ||
|
@@ -160,13 +183,28 @@ workflows: | |
branches: | ||
ignore: /.*/ | ||
- run-win-tests | ||
- release: | ||
filters: | ||
branches: | ||
only: | ||
- main | ||
requires: | ||
- node-latest | ||
- node-12 | ||
- node-10 | ||
- run-win-tests | ||
|
||
publish-workflow: | ||
when: << pipeline.parameters.publish >> | ||
jobs: | ||
- slack/approval-notification: | ||
message: Pending Approval for Publish of SDRL (Source Deploy Retrieve Library) | ||
channel: 'pdt_releases' | ||
color: '#0E1111' | ||
- node-latest | ||
- node-12 | ||
- node-10 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is the cache job needed here as well? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These 4 jobs restore the cache for themselves already I believe - is that what you mean? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm referring to this piece here. I don't think it's needed, but wanted to pose the question just in case:
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think it's needed, at least not with that specific config |
||
- run-win-tests | ||
- hold: # Requires manual approval in Circle Ci | ||
type: approval | ||
- publish: | ||
filters: | ||
branches: | ||
only: | ||
- main | ||
requires: | ||
- node-latest | ||
- node-12 | ||
- node-10 | ||
- run-win-tests | ||
- hold |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
{ | ||
// See https://go.microsoft.com/fwlink/?LinkId=733558 | ||
// for the documentation about the tasks.json format | ||
"version": "2.0.0", | ||
"tasks": [ | ||
{ | ||
"label": "Publish Local Dev Server", | ||
"command": "./script/publish-workflow.sh", | ||
"type": "shell", | ||
"args": ["${input:circleCiId}", "${input:publishType}"] | ||
} | ||
], | ||
"inputs": [ | ||
{ | ||
"id": "circleCiId", | ||
"type": "promptString", | ||
"description": "CircleCi Token" | ||
}, | ||
{ | ||
"id": "publishType", | ||
"type": "pickString", | ||
"description": "Type of version to publish", | ||
"options": ["minor", "patch", "major"], | ||
"default": "patch" | ||
} | ||
] | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#!/usr/bin/env bash | ||
|
||
# For publishing a different version, see the format below for adding a publish-type | ||
# parameter: | ||
# "publish-type": "minor" | ||
|
||
CircleCIToken=$1 | ||
PublishType=$2 | ||
curl -v -u ${CircleCIToken}: -X POST --header "Content-Type: application/json" -d '{ | ||
"branch": "main", | ||
"parameters": { | ||
"publish": true, | ||
"publish-type": "'"${PublishType}"'" | ||
} | ||
}' https://circleci.com/api/v2/project/gh/forcedotcom/source-deploy-retrieve/pipeline |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For future reference - there's additional setup that has to take place for the slack integration. This is the guide I am following.
Section: