mirror of
https://github.com/angular/angular-cli.git
synced 2025-05-17 02:54:21 +08:00
ci: use snapshot deploy secret directly
Instead of encoding the GitHub snapshot robot access token in a file that needs to be decoded by an ambiguously named secret called `KEY`, the token can be directly stored in the secrets of CircleCI given easier maintenance and the same risk. The leakage of the secret still means the GitHub token file could be decoded. We are switching to a similar model as in the components repo, which also simplifies key rotations etc.
This commit is contained in:
parent
7f93735e98
commit
c608955532
@ -317,17 +317,9 @@ jobs:
|
||||
steps:
|
||||
- custom_attach_workspace
|
||||
- install_python
|
||||
- run:
|
||||
name: Decrypt Credentials
|
||||
# Note: when changing the image, you might have to re-encrypt the credentials with a
|
||||
# matching version of openssl.
|
||||
# See https://stackoverflow.com/a/43847627/2116927 for more info.
|
||||
command: |
|
||||
openssl aes-256-cbc -d -in .circleci/github_token -k "${KEY}" -out ~/github_token -md md5
|
||||
- run:
|
||||
name: Deployment to Snapshot
|
||||
command: |
|
||||
yarn admin snapshots --verbose --githubTokenFile=${HOME}/github_token
|
||||
command: yarn admin snapshots --verbose
|
||||
- fail_fast
|
||||
|
||||
publish_artifacts:
|
||||
|
@ -1 +0,0 @@
|
||||
Salted__zÈùº¬ö"Bõ¾Y¾’|‚Û<E2809A>¢V”QÖ³UzWò±/G…îR¡e}j‘%þÿ¦<%öáÉÿ–¼
|
@ -130,7 +130,6 @@ async function _publishSnapshot(
|
||||
|
||||
export interface SnapshotsOptions {
|
||||
force?: boolean;
|
||||
githubTokenFile?: string;
|
||||
githubToken?: string;
|
||||
branch?: string;
|
||||
}
|
||||
@ -151,11 +150,7 @@ export default async function (opts: SnapshotsOptions, logger: logging.Logger) {
|
||||
branch = '' + process.env['CIRCLE_BRANCH'];
|
||||
}
|
||||
|
||||
const githubToken = (
|
||||
opts.githubToken ||
|
||||
(opts.githubTokenFile && fs.readFileSync(opts.githubTokenFile, 'utf-8')) ||
|
||||
''
|
||||
).trim();
|
||||
const githubToken = (opts.githubToken || process.env.SNAPSHOT_BUILDS_GITHUB_TOKEN || '').trim();
|
||||
|
||||
if (githubToken) {
|
||||
logger.info('Setting up global git name.');
|
||||
|
Loading…
x
Reference in New Issue
Block a user