fix(ci): env can not be in workflow

This commit is contained in:
Clark Du 2018-12-31 09:24:41 +00:00
parent 0f7b07f8c1
commit 0e9eca2f9c

View File

@ -13,6 +13,26 @@ release_branches: &release_branches
- dev - dev
- next - next
release: &release
<<: *defaults
steps:
- checkout
- attach_workspace:
at: ~/project
- run:
name: release
command: |
if echo "$COMMIT_MSG" | grep -o "\[release\]"; then
echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> ~/.npmrc
echo "//registry.yarnpkg.com/:_authToken=$NPM_TOKEN" >> ~/.npmrc
yarn lerna version --yes --no-git-tag-version --no-push
PACKAGE_SUFFIX=edge yarn build
if [ "$CIRCLE_BRANCH" = "next" ]; then tag="--tag next"; fi
./scripts/workspace-run npm publish $tag -q
else
echo "Release phase is skipped."
fi
jobs: jobs:
# -------------------------------------------------------------------------- # --------------------------------------------------------------------------
# Phase 1: Setup # Phase 1: Setup
@ -112,25 +132,15 @@ jobs:
# -------------------------------------------------------------------------- # --------------------------------------------------------------------------
# Phase 4: Release (dev branch only) # Phase 4: Release (dev branch only)
# -------------------------------------------------------------------------- # --------------------------------------------------------------------------
release: release-commit:
<<: *defaults <<: *release
steps: environment:
- checkout COMMIT_MSG: '[release]'
- attach_workspace:
at: ~/project release-nightly:
- run: <<: *release
name: release environment:
command: | COMMIT_MSG: $(git log --format=oneline -n 1 $CIRCLE_SHA1)
if echo "$COMMIT_MSG" | grep -o "\[release\]"; then
echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> ~/.npmrc
echo "//registry.yarnpkg.com/:_authToken=$NPM_TOKEN" >> ~/.npmrc
yarn lerna version --yes --no-git-tag-version --no-push
PACKAGE_SUFFIX=edge yarn build
if [ "$CIRCLE_BRANCH" = "next" ]; then tag="--tag next"; fi
./scripts/workspace-run npm publish $tag -q
else
echo "Release phase is skipped."
fi
# Workflow definition # Workflow definition
workflows: workflows:
@ -146,12 +156,10 @@ workflows:
- build: { requires: [setup] } - build: { requires: [setup] }
- test-unit: { requires: [build] } - test-unit: { requires: [build] }
- test-e2e: { requires: [build] } - test-e2e: { requires: [build] }
- release: - release-commit:
requires: [build, lint, audit, test-unit, test-e2e] requires: [build, lint, audit, test-unit, test-e2e]
filters: filters:
<<: *release_branches <<: *release_branches
environment:
COMMIT_MSG: $(git log --format=oneline -n 1 $CIRCLE_SHA1)
# Release nightly builds on release branches # Release nightly builds on release branches
nightly: nightly:
@ -162,10 +170,8 @@ workflows:
- build: { requires: [setup] } - build: { requires: [setup] }
- test-unit: { requires: [build] } - test-unit: { requires: [build] }
- test-e2e: { requires: [build] } - test-e2e: { requires: [build] }
- release: - release-nightly:
requires: [build, lint, audit, test-unit, test-e2e] requires: [build, lint, audit, test-unit, test-e2e]
environment:
COMMIT_MSG: '[release]'
triggers: triggers:
- schedule: - schedule:
cron: "0 0 * * *" cron: "0 0 * * *"