Skip to content

Commit 996feaa

Browse files
committed
ci: add snapshots to CircleCI
1 parent 63fcd27 commit 996feaa

File tree

3 files changed

+27
-2
lines changed

3 files changed

+27
-2
lines changed

.circleci/config.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,22 @@ jobs:
8181
paths:
8282
- "node_modules"
8383

84+
snapshot_publish:
85+
<<: *defaults
86+
steps:
87+
- checkout:
88+
<<: *post_checkout
89+
- restore_cache:
90+
key: angular_devkit-{{ checksum "package-lock.json" }}
91+
92+
- run:
93+
name: Decrypt Credentials
94+
command: |
95+
openssl aes-256-cbc -d -in .circleci/github_token -k "${KEY}" -out ~/github_token
96+
- run:
97+
name: Deployment to Snapshot
98+
command: |
99+
npm run admin -- snapshots --verbose --githubToken="$(cat ~/github_token)"
84100
85101
workflows:
86102
version: 2
@@ -91,3 +107,10 @@ workflows:
91107
- build
92108
- test
93109
- integration
110+
- snapshot_publish:
111+
requires:
112+
- test
113+
- integration
114+
filters:
115+
branches:
116+
only: master

.circleci/github_token

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Salted__3 �H ��-V@�:}�<ˀy� �
2+
_K���7KIKʹ,w����f�Ao*y�fX��

scripts/snapshots.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ function _copy(from: string, to: string) {
3131
}
3232

3333

34-
export default function(opts: { force?: boolean }, logger: logging.Logger) {
34+
export default function(opts: { force?: boolean, githubToken: string }, logger: logging.Logger) {
3535
// Get the SHA.
3636
if (execSync(`git status --porcelain`).toString() && !opts.force) {
3737
logger.error('You cannot run snapshots with local changes.');
@@ -66,7 +66,7 @@ export default function(opts: { force?: boolean }, logger: logging.Logger) {
6666

6767
execSync(`git config credential.helper "store --file=.git/credentials"`, { cwd: destPath });
6868
fs.writeFileSync(path.join(destPath, '.git/credentials'),
69-
`https://${process.env['GITHUB_ACCESS_TOKEN']}@github.com`);
69+
`https://${opts.githubToken}@github.com`);
7070

7171
// Make sure that every snapshots is unique.
7272
fs.writeFileSync(path.join(destPath, 'uniqueId'), '' + new Date());

0 commit comments

Comments
 (0)