circleci: Fix automatic deployment

This commit is contained in:
Jonatan Nilsson 2020-09-04 16:15:09 +00:00
parent 869b9f8b2e
commit 96e53e776c

View file

@ -8,16 +8,23 @@ jobs:
- checkout - checkout
- run: - run:
name: Install npm deployment app name: Install npm deployment app
command: npm install -g github-release-cli command: sudo npm install -g github-release-cli
- deploy: - deploy:
name: Create a release name: Create a release
command: | command: |
PACKAGE_VERSION=$(cat package.json \ PACKAGE_VERSION=$(cat package.json | grep version | head -1 | awk -F: '{ print $2 }' | sed 's/[", ]//g')
| grep version \ echo "Packaging to ${CIRCLE_PROJECT_REPONAME}_build-sc.zip"
| head -1 \ zip "${CIRCLE_PROJECT_REPONAME}_build-sc.zip" index.mjs package.json api/**
| awk -F: '{ print $2 }' \
| sed 's/[",]//g')
echo "Creating release '${PACKAGE_VERSION}.${CIRCLE_BUILD_NUM}'" 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}"
--body "Automatic CircleCI Build of v${PACKAGE_VERSION}.${CIRCLE_BUILD_NUM} from ${CIRCLE_SHA1}" \
sc-helloworld_build-sc.zip
workflows: workflows:
version: 2 version: 2