include: - project: bdfx/others/gitlab-pipelines file: .gitlab-ci-helpers.yml image: node:current-alpine stages: - build-prod - notify cache: paths: - node_modules/ - .yarn build: stage: build-prod before_script: - apk add curl - yarn config set cache-folder .yarn - yarn install variables: SLACK_COLOR: good SLACK_USERNAME: GitLab SLACK_ICON: ":heavy_check_mark:" SLACK_TEXT: "MUI - new version published" script: - echo "Building pack..." - yarn build - "VERSION=$(grep version package.json | sed s/[^0-9\\.]//g)" - echo "Trying to publish version $VERSION ..." - echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN_MARTINH}" > ~/.npmrc - 'npm publish --access="public" --loglevel=error && curl -X POST -H "Content-type: application/json" --data "{\"text\":\"${SLACK_TEXT} $VERSION\",\"color\":\"${SLACK_COLOR}\",\"channel\":\"${SLACK_WEBHOOK_CHANNEL}\",\"icon_emoji\":\"${SLACK_ICON}\"}" ${SLACK_WEBHOOK_URL} || echo "Publish failed. No new version?"' only: - master notify slack success: stage: notify extends: .call_slack when: on_success only: - master notify slack error: stage: notify extends: .call_slack when: on_failure variables: SLACK_COLOR: error SLACK_ICON: ":radioactive_sign:" SLACK_TEXT: "${CI_PROJECT_PATH} pipeline: FAILED\n${CI_PIPELINE_URL}" only: - master