Skip to content

Commit e5c95ce

Browse files
fix issues with token generation circleci (ethereum-optimism#1094)
* fix issues * fix issues * remove github actions * fix
1 parent b656304 commit e5c95ce

File tree

6 files changed

+41
-267
lines changed

6 files changed

+41
-267
lines changed

.circleci/config.yml

+41-46
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
version: 2.1
22

33
orbs:
4-
utils: ethereum-optimism/circleci-utils@dev:first
4+
utils: ethereum-optimism/circleci-utils@1.0.17
55
node: circleci/[email protected]
66

77
parameters:
@@ -18,79 +18,64 @@ commands:
1818
setup:
1919
description: "Setup Node.js environment with pnpm and nx"
2020
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
3822
- run:
3923
name: Install dependencies
4024
environment:
4125
NPM_TOKEN: nada
4226
command: |
4327
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
4438
4539
4640
jobs:
4741
generate-token-list:
4842
machine:
4943
image: ubuntu-2204:2024.08.1
5044
steps:
51-
- checkout
45+
- continue-if-not-bot
5246
- setup
5347
- run:
5448
name: Update version and generate token list
5549
command: |
5650
# Patch version and generate token list
5751
npm version patch
5852
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
7553
- utils/github-commit-and-push-changes-single-file:
7654
commit-username: "mergify[bot]"
7755
commit-email: "mergify[bot]@users.noreply.github.com"
7856
commit-message: "bot(ci): generate token list"
7957
skip-ci: true
8058
file: "optimism.tokenlist.json"
81-
condition: "$PERFORM_COMMIT" # will skip if push to branch run by a non github user
8259

83-
publish-bot:
60+
publish:
8461
machine:
8562
image: ubuntu-2204:2024.08.1
8663
steps:
87-
- checkout
64+
- continue-if-not-bot
8865
- setup
66+
- run:
67+
name: Make sure we are getting the latest updates on the current branch
68+
command: |
69+
git pull
8970
- run:
9071
name: Build
9172
command: pnpm build:ci
9273
environment:
9374
NPM_TOKEN: nada
75+
- run:
76+
name: Make sure we are getting the latest updates on the branch
77+
command: |
78+
git pull
9479
- run:
9580
name: Publish package
9681
command: pnpm publish
@@ -112,7 +97,6 @@ jobs:
11297
docker:
11398
- image: cimg/node:16.20
11499
steps:
115-
- checkout
116100
- setup
117101
- run:
118102
name: Run Tests
@@ -123,7 +107,6 @@ jobs:
123107
docker:
124108
- image: cimg/node:16.20
125109
steps:
126-
- checkout
127110
- setup
128111
- run:
129112
name: Save PR number
@@ -180,21 +163,27 @@ jobs:
180163

181164
workflows:
182165
generate-token-list-workflow:
183-
184166
when:
185167
or:
186168
- equal: [<< pipeline.parameters.run_job >>, "generate-token-list"]
187169
- and:
188170
- equal: [<< pipeline.git.branch >>, "master"]
189-
- not:
190-
equal: [<< pipeline.trigger_source >>, "api"]
171+
- equal: [<< pipeline.trigger_source >>, "webhook"]
191172
jobs:
173+
- validate:
174+
filters:
175+
branches:
176+
only: master
177+
- test:
178+
filters:
179+
branches:
180+
only: master
192181
- generate-token-list:
193182
context: circleci-repo-ethereum-optimism.github.io
194183
filters:
195184
branches:
196185
only: master
197-
- publish-bot:
186+
- publish:
198187
context: circleci-repo-ethereum-optimism.github.io
199188
requires:
200189
- generate-token-list
@@ -208,8 +197,14 @@ workflows:
208197

209198
test-workflow:
210199
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
212204

213205
validate-workflow:
214206
jobs:
215-
- validate
207+
- validate:
208+
filters:
209+
branches:
210+
ignore: master

.github/workflows/generate.yml

-50
This file was deleted.

.github/workflows/publish.yml

-38
This file was deleted.

.github/workflows/stale.yml

-19
This file was deleted.

.github/workflows/test.yml

-35
This file was deleted.

0 commit comments

Comments
 (0)