2020-09-09 15:43:54 +00:00
|
|
|
version: 2
|
|
|
|
jobs:
|
|
|
|
build:
|
|
|
|
docker:
|
|
|
|
- image: circleci/node:latest
|
|
|
|
working_directory: ~/app
|
|
|
|
steps:
|
|
|
|
- checkout
|
2020-09-09 16:44:29 +00:00
|
|
|
- run:
|
|
|
|
name: Get current git commit message
|
|
|
|
command: |
|
|
|
|
echo "export COMMIT_MESSAGE=\"$(git log --format=oneline -n 1 $CIRCLE_SHA1)\"" >> $BASH_ENV
|
|
|
|
source $BASH_ENV
|
2020-09-09 15:43:54 +00:00
|
|
|
- run:
|
|
|
|
name: Install npm deployment app
|
|
|
|
command: sudo npm install -g github-release-cli
|
2020-09-09 16:12:20 +00:00
|
|
|
- run:
|
|
|
|
name: Build client javascript
|
|
|
|
command: |
|
|
|
|
npm install
|
|
|
|
npm run build
|
2020-09-09 15:43:54 +00:00
|
|
|
- deploy:
|
|
|
|
name: Create a release
|
|
|
|
command: |
|
|
|
|
PACKAGE_VERSION=$(cat package.json | grep version | head -1 | awk -F: '{ print $2 }' | sed 's/[", ]//g')
|
|
|
|
echo "Packaging to ${CIRCLE_PROJECT_REPONAME}_build-sc.zip"
|
2020-09-09 16:44:29 +00:00
|
|
|
zip "${CIRCLE_PROJECT_REPONAME}_build-sc.zip" index.mjs package.json api/**/*
|
2020-09-09 15:43:54 +00:00
|
|
|
echo "Creating release '${PACKAGE_VERSION}.${CIRCLE_BUILD_NUM}'"
|
|
|
|
github-release upload \
|
|
|
|
--commitish $CIRCLE_SHA1 \
|
|
|
|
--token $GITHUB_TOKEN \
|
|
|
|
--owner $CIRCLE_PROJECT_USERNAME \
|
|
|
|
--repo $CIRCLE_PROJECT_REPONAME \
|
|
|
|
--tag "v${PACKAGE_VERSION}.${CIRCLE_BUILD_NUM}" \
|
|
|
|
--name "v${PACKAGE_VERSION}.${CIRCLE_BUILD_NUM}" \
|
2020-09-09 16:44:29 +00:00
|
|
|
--body "Automatic CircleCI Build of v${PACKAGE_VERSION}.${CIRCLE_BUILD_NUM} from ${CIRCLE_SHA1}: ${COMMIT_MESSAGE}" \
|
2020-09-09 16:12:20 +00:00
|
|
|
"${CIRCLE_PROJECT_REPONAME}_build-sc.zip"
|
2020-09-09 15:43:54 +00:00
|
|
|
|
|
|
|
workflows:
|
|
|
|
version: 2
|
|
|
|
build_deploy:
|
|
|
|
jobs:
|
|
|
|
- build:
|
|
|
|
context: github-thething
|