service-core/.circleci/config.yml

58 lines
2.4 KiB
YAML

version: 2
jobs:
build:
docker:
- image: circleci/node:latest
resource_class: medium
working_directory: ~/app
steps:
- checkout
- run:
name: Install npm deployment app
command: sudo npm install -g github-release-cli @babel/runtime
- run:
name: Check if this is a new release
command: |
set +e
PACKAGE_VERSION=$(cat package.json | grep version | head -1 | awk -F: '{ print $2 }' | sed 's/[", ]//g')
github-release list --owner $CIRCLE_PROJECT_USERNAME --repo $CIRCLE_PROJECT_REPONAME | grep "tag_name=\"v${PACKAGE_VERSION}\""
retVal=$?
if [ $retVal -eq 0 ]; then
echo "Release already exists. Quitting early"
circleci step halt
fi
- 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
- run:
name: Get 7zz
command: |
wget https://www.7-zip.org/a/7z2106-linux-x64.tar.xz
tar -xvf 7z2106-linux-x64.tar.xz
- deploy:
name: Create a release
command: |
PACKAGE_VERSION=$(cat package.json | grep version | head -1 | awk -F: '{ print $2 }' | sed 's/[", ]//g')
echo "Creating release v${PACKAGE_VERSION}"
./7zz a "${CIRCLE_PROJECT_REPONAME}_build-sc-core.7z" runner.mjs package.json "service/*" "core/**/*" "core/*" -mx9 -mfb273 -mmt2 -md16M -mqs -myx9
./7zz a "${CIRCLE_PROJECT_REPONAME}_app.zip" runner.mjs package.json "service/*" "core/**/*" "core/*" config.json install.bat npminstall.bat README.md uninstall.bat
echo "Creating release '${PACKAGE_VERSION}'"
github-release upload \
--commitish $CIRCLE_SHA1 \
--token $GITHUB_TOKEN \
--owner $CIRCLE_PROJECT_USERNAME \
--repo $CIRCLE_PROJECT_REPONAME \
--tag "v${PACKAGE_VERSION}" \
--release-name "v${PACKAGE_VERSION}" \
--body "Automatic CircleCI Build of v${PACKAGE_VERSION} from ${CIRCLE_SHA1}: ${COMMIT_MESSAGE}" \
"${CIRCLE_PROJECT_REPONAME}_build-sc-core.zip" "${CIRCLE_PROJECT_REPONAME}_app.zip"
workflows:
version: 2
build_deploy:
jobs:
- build:
context: github-thething