Skip to content

Commit ba6e1a2

Browse files
author
Dane Pilcher
authored
ci: add tagged release (#300)
1 parent 8b02361 commit ba6e1a2

File tree

4 files changed

+35
-6
lines changed

4 files changed

+35
-6
lines changed

.circleci/config.yml

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,12 @@ jobs:
4949
- checkout
5050
- restore_node_modules
5151
- run: npm run build
52+
- save_cache:
53+
key: dist-{{ .Environment.CIRCLE_SHA1 }}
54+
paths:
55+
- packages/codegen-ui/dist
56+
- packages/codegen-ui-react/dist
57+
- packages/test-generator/dist
5258

5359
unit-test:
5460
docker:
@@ -70,16 +76,15 @@ jobs:
7076
steps:
7177
- checkout
7278
- restore_node_modules
79+
- restore_cache:
80+
keys:
81+
- dist-{{ .Environment.CIRCLE_SHA1 }}
7382
- run:
7483
name: NPM Login
7584
command: npm set "//registry.npmjs.org/:_authToken" $NPM_ACCESS_TOKEN
7685
- run:
7786
name: NPM Publish
78-
command: >-
79-
if [[ `git log --format=%s -n 1` =~ ^chore\(release\):\ v.* ]];
80-
then npx lerna publish from-git -y;
81-
else npx lerna publish --pre-dist-tag next --canary -y;
82-
fi
87+
command: bash ./.circleci/publish.sh
8388

8489
workflows:
8590
build:
@@ -104,6 +109,7 @@ workflows:
104109
only:
105110
- main
106111
- develop
112+
- /tagged-release\/.*/
107113

108114
commands:
109115
create_concatenated_package_lock:

.circleci/publish.sh

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#!/bin/bash -e
2+
3+
if [[ `git log --format=%s -n 1` =~ ^chore\(release\):\ v.* ]]; then
4+
# production release
5+
npx lerna publish from-git --ignore-scripts -y;
6+
else
7+
# pre-release or tagged release
8+
# if branch starts with tagged-release/ then do tagged release, else pre-release
9+
npx lerna publish --canary --ignore-scripts -y \
10+
--preid $([[ $CIRCLE_BRANCH =~ ^tagged-release\/.* ]] \
11+
&& echo $(echo $CIRCLE_BRANCH | sed 's:.*/::') --no-pre-dist-tag \
12+
|| echo alpha --pre-dist-tag next);
13+
fi

CONTRIBUTING.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,17 @@ npm install @aws-amplify/codegen-ui-react@next
149149

150150
See [lerna publish docs](https://github.com/lerna/lerna/tree/main/commands/publish) for further detail.
151151

152+
### Tagged Release
153+
154+
A tagged release is used to release emergent or prototype changes without merging into `main`.
155+
To create a tagged release create a pull request or push directly to a branch with the prefix `tagged-release/`.
156+
(Ex. `tagged-release/fix-properties`).
157+
The branch name must not contain any additional forward slashes after `tagged-release/`.
158+
The tagged release will use the same versioning process as the pre-release except:
159+
160+
- the preid will be the branch name with `tagged-release/` removed. (Ex. `1.1.1-fix-properties.270+2baaca9`)
161+
- the release will not be published under any dist tag
162+
152163
### Icons
153164

154165
The built-in iconset is genereted with `packages/scripts/generateBuiltInIconset.js`.

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
"test": "lerna run test --stream",
1111
"test:update": "lerna run test:update --stream",
1212
"build": "lerna run build --stream",
13-
"prepublishOnly": "npm run build && npm run test",
1413
"setup-dev": "npm install && lerna bootstrap && lerna run build",
1514
"clean": "lerna run clean && lerna exec npm run rimraf tsconfig.tsbuildinfo && lerna clean --yes && npm run rimraf node_modules",
1615
"prepare": "husky install",

0 commit comments

Comments
 (0)