1
- name : ci-cd
1
+ name : ci
2
+
2
3
on :
4
+ push :
5
+ branches :
6
+ - ' **'
3
7
pull_request :
4
8
branches :
5
9
- master
6
10
- development
7
- push :
8
- branches :
9
- - ' *'
10
11
11
12
concurrency :
12
- group : ${{ github.workflow }}-${{ github.event_name == 'push' && github.run_number || github. event.pull_request.number }}
13
+ group : ${{ github.workflow }}-${{ github.event.pull_request.number }}
13
14
cancel-in-progress : true
14
15
15
16
permissions :
@@ -44,41 +45,39 @@ jobs:
44
45
- name : npm build
45
46
run : BUILD_BRANCH=$(echo "${GITHUB_REF#refs/heads/}") BUILD_COMMIT=${{ github.sha }} npm run build
46
47
48
+ - name : Set VERSION env
49
+ run : echo "VERSION=$(cat package.json | jq -r .version)" >> $GITHUB_ENV
50
+
47
51
- name : SonarQube Scan (Push)
48
- if : ${{ github.event_name == 'push' && (github.ref == 'refs/heads/development ' || github.ref == 'refs/heads/master') }}
49
- uses : SonarSource/sonarcloud-github-action@v1.8
52
+ if : github.event_name == 'push' && (github.ref == 'refs/heads/master ' || github.ref == 'refs/heads/development')
53
+ uses : SonarSource/sonarcloud-github-action@v1.9
50
54
env :
51
55
SONAR_TOKEN : ${{ secrets.SONARQUBE_TOKEN }}
56
+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
52
57
with :
53
58
projectBaseDir : .
54
59
args : >
55
60
-Dsonar.host.url=${{ secrets.SONARQUBE_HOST }}
56
- -Dsonar.projectName=${{ github.event.repository.name }}
57
- -Dsonar.projectKey=${{ github.event.repository.name }}
58
- -Dsonar.javascript.lcov.reportPaths=./coverage/lcov.info
59
- -Dsonar.links.ci="https://github.com/splitio/${{ github.event.repository.name }}/actions"
60
- -Dsonar.links.scm="https://github.com/splitio/${{ github.event.repository.name }}"
61
+ -Dsonar.projectVersion=${{ env.VERSION }}
62
+ -Dsonar.branch.name=${{ github.ref_name }}
61
63
62
64
- name : SonarQube Scan (Pull Request)
63
65
if : github.event_name == 'pull_request'
64
- uses : SonarSource/sonarcloud-github-action@v1.8
66
+ uses : SonarSource/sonarcloud-github-action@v1.9
65
67
env :
66
68
SONAR_TOKEN : ${{ secrets.SONARQUBE_TOKEN }}
69
+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
67
70
with :
68
71
projectBaseDir : .
69
72
args : >
70
73
-Dsonar.host.url=${{ secrets.SONARQUBE_HOST }}
71
- -Dsonar.projectName=${{ github.event.repository.name }}
72
- -Dsonar.projectKey=${{ github.event.repository.name }}
73
- -Dsonar.links.ci="https://github.com/splitio/${{ github.event.repository.name }}/actions"
74
- -Dsonar.links.scm="https://github.com/splitio/${{ github.event.repository.name }}"
75
- -Dsonar.javascript.lcov.reportPaths=./coverage/lcov.info
74
+ -Dsonar.projectVersion=${{ env.VERSION }}
76
75
-Dsonar.pullrequest.key=${{ github.event.pull_request.number }}
77
76
-Dsonar.pullrequest.branch=${{ github.event.pull_request.head.ref }}
78
77
-Dsonar.pullrequest.base=${{ github.event.pull_request.base.ref }}
79
78
80
79
- name : Store assets
81
- if : ${{ github.event_name == 'push' && (github.ref == 'refs/heads/development ' || github.ref == 'refs/heads/master') }}
80
+ if : github.event_name == 'push' && (github.ref == 'refs/heads/master ' || github.ref == 'refs/heads/development')
82
81
uses : actions/upload-artifact@v3
83
82
with :
84
83
name : assets
@@ -89,19 +88,15 @@ jobs:
89
88
name : Upload assets
90
89
runs-on : ubuntu-latest
91
90
needs : build
92
- if : ${{ github.event_name == 'push' && github.ref == 'refs/heads/development' }}
91
+ if : github.event_name == 'push' && github.ref == 'refs/heads/development'
93
92
strategy :
94
93
matrix :
95
94
environment :
96
95
- stage
97
- # - stage-eu
98
96
include :
99
97
- environment : stage
100
98
account_id : " 079419646996"
101
99
bucket : split-public-stage
102
- # - environment: stage-eu
103
- # account_id: "901851837056"
104
- # bucket: split-public-stage-eu-west-1
105
100
106
101
steps :
107
102
- name : Download assets
@@ -132,19 +127,15 @@ jobs:
132
127
name : Upload assets
133
128
runs-on : ubuntu-latest
134
129
needs : build
135
- if : ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }}
130
+ if : github.event_name == 'push' && github.ref == 'refs/heads/master'
136
131
strategy :
137
132
matrix :
138
133
environment :
139
134
- prod
140
- # - prod-eu
141
135
include :
142
136
- environment : prod
143
137
account_id : " 825951051969"
144
138
bucket : split-public
145
- # - environment: prod-eu
146
- # account_id: "842946900133"
147
- # bucket: split-public-eu-west-1
148
139
149
140
steps :
150
141
- name : Download assets
0 commit comments