Skip to content
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

FE-1667 slack notification #547

Merged
merged 21 commits into from
Oct 13, 2021
20 changes: 20 additions & 0 deletions concourse/pipeline.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
---
resource_types:
- name: slack-notification
type: docker-image
source:
repository: cfcommunity/slack-notification-resource

resources:
- name: notify
type: slack-notification
source:
url: ((slack-webhook))

- name: fauna-js-repository
type: git
icon: github
Expand Down Expand Up @@ -39,6 +50,15 @@ jobs:
file: fauna-js-repository/concourse/tasks/browserify-and-npm-publish.yml
params:
NPM_TOKEN: ((npm_token))
on_success:
put: notify
params:
text_file: slack-message/publish
on_failure:
put: notify
params:
text_file: slack-message/publish


- task: publish-docs
file: fauna-js-repository/concourse/tasks/publish-docs.yml
Expand Down
15 changes: 9 additions & 6 deletions concourse/scripts/publish.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,26 @@ set -eou

cd ./fauna-js-repository

mkdir dist
npm install
npm run browserify
npm run browserify-min

PACKAGE_VERSION=$(node -p -e "require('./package.json').version")
NPM_LATEST_VERSION=$(npm view faunadb version)
echo "Current package version: $PACKAGE_VERSION"
echo "Latest version in npm: $NPM_LATEST_VERSION"

if [ "$PACKAGE_VERSION" \> "$NPM_LATEST_VERSION" ]
then
mkdir dist
npm install
npm run browserify
npm run browserify-min

echo "Publishing a new version..."
echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" > .npmrc
npm publish
rm .npmrc

echo "faunadb-js@$PACKAGE_VERSION published to npm" > ../slack-message/publish
else
echo "NPM package already published on npm with version ${NPM_LATEST_VERSION}" 1>&2
echo "faunadb-js@${NPM_LATEST_VERSION} package has been already published" > ../slack-message/publish
echo "faunadb-js@${NPM_LATEST_VERSION} package has been already published" 1>&2
exit 1
fi
3 changes: 3 additions & 0 deletions concourse/tasks/browserify-and-npm-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,8 @@ params:
inputs:
- name: fauna-js-repository

outputs:
- name: slack-message

run:
path: ./fauna-js-repository/concourse/scripts/publish.sh