Skip to content

Commit 96ba8f2

Browse files
committed
ci: fix snapshots
1 parent 27a50de commit 96ba8f2

File tree

3 files changed

+14
-10
lines changed

3 files changed

+14
-10
lines changed

.circleci/config.yml

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,6 @@ jobs:
1414
steps:
1515
- checkout:
1616
<<: *post_checkout
17-
# Check BUILD.bazel formatting before we have a node_modules directory
18-
# Then we don't need any exclude pattern to avoid checking those files
19-
- run: 'buildifier -mode=check $(find . -type f \( -name BUILD.bazel -or -name BUILD \)) ||
20-
(echo "BUILD files not formatted. Please run ''npm run buildifier''" ; exit 1)'
2117
- restore_cache:
2218
key: angular_devkit-{{ checksum "package-lock.json" }}
2319

@@ -93,14 +89,15 @@ jobs:
9389
- restore_cache:
9490
key: angular_devkit-{{ checksum "package-lock.json" }}
9591

92+
- run: npm install --no-save
9693
- run:
9794
name: Decrypt Credentials
9895
command: |
9996
openssl aes-256-cbc -d -in .circleci/github_token -k "${KEY}" -out ~/github_token
10097
- run:
10198
name: Deployment to Snapshot
10299
command: |
103-
npm run admin -- snapshots --verbose --githubToken="$(cat ~/github_token)"
100+
npm run admin -- snapshots --verbose --githubTokenFile=~/github_token
104101
105102
workflows:
106103
version: 2

.circleci/github_token

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
1-
Salted__3 �H ��-V@�:}�<ˀy� �
2-
_K���7KIKʹ,w����f�Ao*y�fX��
1+
Salted__fE~W_�ZA<J�E��D(�E�C��Ms�
2+
v�
3+
���0�Y�=@�J`P*Z�XH�(`

scripts/snapshots.ts

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

3333

34-
export default function(opts: { force?: boolean, githubToken: string }, logger: logging.Logger) {
34+
export interface SnapshotsOptions {
35+
force?: boolean;
36+
githubTokenFile: string;
37+
}
38+
39+
export default function(opts: SnapshotsOptions, logger: logging.Logger) {
3540
// Get the SHA.
3641
if (execSync(`git status --porcelain`).toString() && !opts.force) {
3742
logger.error('You cannot run snapshots with local changes.');
@@ -41,6 +46,8 @@ export default function(opts: { force?: boolean, githubToken: string }, logger:
4146
const root = fs.mkdtempSync(path.join(os.tmpdir(), 'angular-devkit-publish-'));
4247
const message = execSync(`git log --format="%h %s" -n1`).toString().trim();
4348

49+
const githubToken = fs.readFileSync(opts.githubTokenFile, 'utf-8');
50+
4451
// Run build.
4552
logger.info('Building...');
4653
build({ snapshot: true }, logger.createChild('build'));
@@ -65,8 +72,7 @@ export default function(opts: { force?: boolean, githubToken: string }, logger:
6572
_copy(pkg.dist, destPath);
6673

6774
execSync(`git config credential.helper "store --file=.git/credentials"`, { cwd: destPath });
68-
fs.writeFileSync(path.join(destPath, '.git/credentials'),
69-
`https://${opts.githubToken}@github.com`);
75+
fs.writeFileSync(path.join(destPath, '.git/credentials'), `https://${githubToken}@github.com`);
7076

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

0 commit comments

Comments
 (0)