1
1
version : 2.1
2
2
3
3
orbs :
4
- utils : ethereum-optimism/circleci-utils@dev:first
4
+ utils : ethereum-optimism/circleci-utils@1.0.17
5
5
6
6
7
7
parameters :
@@ -18,79 +18,64 @@ commands:
18
18
setup :
19
19
description : " Setup Node.js environment with pnpm and nx"
20
20
steps :
21
- - run :
22
- name : Install mise
23
- command : |
24
- if command -v mise &> /dev/null; then
25
- echo "mise already installed at $(command -v mise)"
26
- else
27
- curl https://mise.run | sh
28
- fi
29
- echo "export PATH=\"$HOME/.local/bin:\$PATH\"" >> "$BASH_ENV"
30
- echo "export MISE_DATA_DIR=\"$HOME/.mise\"" >> "$BASH_ENV"
31
- echo "export MISE_JOBS=$(nproc)" >> "$BASH_ENV"
32
- echo "eval \"\$($HOME/.local/bin/mise activate --shims)\"" >> "$BASH_ENV"
33
- - run :
34
- name : Install mise dependencies
35
- command : |
36
- mise install -v -y
37
- # Install dependencies
21
+ - utils/checkout-with-mise # Install dependencies
38
22
- run :
39
23
name : Install dependencies
40
24
environment :
41
25
NPM_TOKEN : nada
42
26
command : |
43
27
pnpm i --frozen-lockfile
28
+ continue-if-not-bot :
29
+ description : " Continue if the push to branch run by a non github user"
30
+ steps :
31
+ - run :
32
+ name : Check if push to branch run by a non github user
33
+ command : |
34
+ if [ -z "$CIRCLE_USERNAME" ]; then
35
+ echo "CIRCLE_USERNAME is not set"
36
+ circleci-agent step halt
37
+ fi
44
38
45
39
46
40
jobs :
47
41
generate-token-list :
48
42
machine :
49
43
image : ubuntu-2204:2024.08.1
50
44
steps :
51
- - checkout
45
+ - continue-if-not-bot
52
46
- setup
53
47
- run :
54
48
name : Update version and generate token list
55
49
command : |
56
50
# Patch version and generate token list
57
51
npm version patch
58
52
pnpm generate:ci
59
- - run :
60
- name : Check if push to branch run by a non github user
61
- command : |
62
- # skip commit if push to branch run by a non github user
63
- PERFORM_COMMIT="true"
64
- if [ -z "$CIRCLE_USERNAME" ]; then
65
- echo "CIRCLE_USERNAME is not set"
66
- export PERFORM_COMMIT="false"
67
- fi
68
- echo "export PERFORM_COMMIT=$PERFORM_COMMIT" >> $BASH_ENV
69
- # skip commit if there are no differences in optimism.tokenlist.json
70
- if [ -z "$(git diff optimism.tokenlist.json)" ]; then
71
- echo "No changes detected in optimism.tokenlist.json"
72
- export PERFORM_COMMIT="false"
73
- fi
74
- echo "export PERFORM_COMMIT=$PERFORM_COMMIT" >> $BASH_ENV
75
53
- utils/github-commit-and-push-changes-single-file :
76
54
commit-username : " mergify[bot]"
77
55
commit-email : " mergify[bot]@users.noreply.github.com"
78
56
commit-message : " bot(ci): generate token list"
79
57
skip-ci : true
80
58
file : " optimism.tokenlist.json"
81
- condition : " $PERFORM_COMMIT" # will skip if push to branch run by a non github user
82
59
83
- publish-bot :
60
+ publish :
84
61
machine :
85
62
image : ubuntu-2204:2024.08.1
86
63
steps :
87
- - checkout
64
+ - continue-if-not-bot
88
65
- setup
66
+ - run :
67
+ name : Make sure we are getting the latest updates on the current branch
68
+ command : |
69
+ git pull
89
70
- run :
90
71
name : Build
91
72
command : pnpm build:ci
92
73
environment :
93
74
NPM_TOKEN : nada
75
+ - run :
76
+ name : Make sure we are getting the latest updates on the branch
77
+ command : |
78
+ git pull
94
79
- run :
95
80
name : Publish package
96
81
command : pnpm publish
112
97
docker :
113
98
- image : cimg/node:16.20
114
99
steps :
115
- - checkout
116
100
- setup
117
101
- run :
118
102
name : Run Tests
@@ -123,7 +107,6 @@ jobs:
123
107
docker :
124
108
- image : cimg/node:16.20
125
109
steps :
126
- - checkout
127
110
- setup
128
111
- run :
129
112
name : Save PR number
@@ -180,21 +163,27 @@ jobs:
180
163
181
164
workflows :
182
165
generate-token-list-workflow :
183
-
184
166
when :
185
167
or :
186
168
- equal : [<< pipeline.parameters.run_job >>, "generate-token-list"]
187
169
- and :
188
170
- equal : [<< pipeline.git.branch >>, "master"]
189
- - not :
190
- equal : [<< pipeline.trigger_source >>, "api"]
171
+ - equal : [<< pipeline.trigger_source >>, "webhook"]
191
172
jobs :
173
+ - validate :
174
+ filters :
175
+ branches :
176
+ only : master
177
+ - test :
178
+ filters :
179
+ branches :
180
+ only : master
192
181
- generate-token-list :
193
182
context : circleci-repo-ethereum-optimism.github.io
194
183
filters :
195
184
branches :
196
185
only : master
197
- - publish-bot :
186
+ - publish :
198
187
context : circleci-repo-ethereum-optimism.github.io
199
188
requires :
200
189
- generate-token-list
@@ -208,8 +197,14 @@ workflows:
208
197
209
198
test-workflow :
210
199
jobs :
211
- - test
200
+ - test :
201
+ filters :
202
+ branches :
203
+ ignore : master # ignore master branch as it is already validated in generate-token-list-workflow
212
204
213
205
validate-workflow :
214
206
jobs :
215
- - validate
207
+ - validate :
208
+ filters :
209
+ branches :
210
+ ignore : master
0 commit comments