-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcodefresh.yml
More file actions
104 lines (91 loc) · 2.87 KB
/
Copy pathcodefresh.yml
File metadata and controls
104 lines (91 loc) · 2.87 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
# this pipeline should not be run on version tag releases (it may cause a non correct sha to override version tagged image in dockerhub)
version: "1.0"
stages:
- CI
- CD
steps:
main_clone:
title: Cloning main repository...
type: git-clone
repo: '${{CF_REPO_OWNER}}/${{CF_REPO_NAME}}'
revision: '${{CF_REVISION}}'
export_gh_token:
title: 'Export GitHub token'
image: quay.io/codefresh/codefresh-shell:0.4.0
shell: bash
commands:
- source /scripts/get-gh-token.sh
- cf_export GITHUB_TOKEN=$GITHUB_TOKEN --mask
obtain_id_token:
title: Obtain OIDC ID Token
type: obtain-oidc-id-token
arguments:
AUDIENCE: codefresh-shared-services-account
assume_codefresh_inc_get_asm_secrets_role:
type: aws-sts-assume-role-with-web-identity
title: Assume codefresh-inc-get-asm-secrets IRSA role
arguments:
ROLE_SESSION_NAME: codefresh-inc-get-asm-secrets
WEB_IDENTITY_TOKEN: ${{ID_TOKEN}}
ROLE_ARN: arn:aws:iam::734022025880:role/codefresh-inc-get-asm-secrets
export_secrets:
image: quay.io/codefresh/codefresh-shell:0.4.0
title: Get secrets from AWS Secrets Manager
environment:
- AWS_REGION=us-east-1
- AWS_ASM_SECRET_NAME=global/pipelines/codefresh-inc/npm
commands:
- | #shell
set +x
aws secretsmanager get-secret-value --secret-id $AWS_ASM_SECRET_NAME --query SecretString --output text \
| jq -r 'to_entries[] | "\(.key)=\(.value)"' \
| xargs -L1 cf_export --mask
install_dependencies:
title: 'Installing testing dependencies'
stage: CI
image: codefresh/build-cli
commands:
- yarn install --frozen-lockfile
eslint:
title: 'Running linting logic'
stage: CI
image: codefresh/build-cli
commands:
- yarn eslint
unit-tests:
stage: CI
title: 'Running unit tests'
image: codefresh/build-cli
commands:
- yarn test
add_git_tag:
title: "Add Git tag"
stage: CD
image: codefresh/cli
commands:
- 'apk update && apk add jq'
- 'export PACKAGE_VERSION=$(jq -r ".version" package.json)'
- "echo Current version: $PACKAGE_VERSION"
- "cf_export PACKAGE_VERSION"
- "git tag $PACKAGE_VERSION"
when:
branch:
only: [ master ]
create_release:
stage: CD
title: "Create github release"
image: codefresh/build-cli
commands:
- 'curl --fail -X POST -d ''{"tag_name":"v${{PACKAGE_VERSION}}","target_commitish":"${{CF_REVISION}}","name":"Codefresh V${{PACKAGE_VERSION}}"}'' -H "Content-Type: application/json" -H "Authorization: token ${{GITHUB_TOKEN}}" https://api.github.com/repos/codefresh-io/js-sdk/releases'
when:
branch:
only: [ master ]
deploy_to_npm:
stage: CD
type: npm-publish
arguments:
NPM_TOKEN: '${{NPM_TOKEN}}'
DIR: '${{CF_REPO_NAME}}'
when:
branch:
only: [ master ]