Skip to content

Commit 734e552

Browse files
authored
CI updates to handle V2 release (#1006)
* feat: handle v2 * chore: node 20 * chore: keep default ci
1 parent 5848cac commit 734e552

File tree

3 files changed

+643
-1948
lines changed

3 files changed

+643
-1948
lines changed

.github/workflows/ci.yml

+3-44
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,18 @@ on:
44
push:
55
branches:
66
- main
7+
- develop
8+
- "release*"
79
pull_request:
810
types: [opened, synchronize]
911

1012
jobs:
11-
1213
install_dependencies:
1314
runs-on: ubuntu-latest
1415
steps:
1516
- name: Checkout
1617
uses: actions/checkout@v3
17-
with:
18+
with:
1819
token: ${{ secrets.GITHUB_TOKEN }}
1920
fetch-depth: 0
2021
- uses: actions/setup-node@v3
@@ -108,45 +109,3 @@ jobs:
108109
node-version: 16
109110
sarif: results.sarif
110111
fail-on: high
111-
112-
# WIP can safely be ignored
113-
# gasCompare:
114-
# runs-on: ubuntu-latest
115-
# needs: install_dependencies
116-
# steps:
117-
# - uses: bissolli/gh-action-persist-workspace@v1
118-
# with:
119-
# action: retrieve
120-
# - name: Run GasCompare
121-
# run: |
122-
# if [ "$GITHUB_EVENT_NAME" == "pull_request" ]; then
123-
# BRANCH_NAME=$GITHUB_HEAD_REF
124-
# else
125-
# BRANCH_NAME=$(echo ${GITHUB_REF#refs/heads/} | sed 's/\//-/g')
126-
# fi
127-
# echo "Current branch is $BRANCH_NAME"
128-
# if [ "$BRANCH_NAME" == "master" ]; then
129-
# echo "This is the master branch. Exiting..."
130-
# exit 0
131-
# fi
132-
# CI=true npm run test
133-
# mv ./gasReporterOutput.json /tmp/gasReporterOutput_Current.json
134-
# git checkout master
135-
# npm install
136-
# CI=true npm run test
137-
# mv ./gasReporterOutput.json /tmp/gasReporterOutput_Master.json
138-
139-
# - uses: bissolli/gh-action-persist-workspace@v1
140-
# with:
141-
# action: persist
142-
143-
# - name: Checkout
144-
# uses: actions/checkout@v3
145-
146-
# - uses: bissolli/gh-action-persist-workspace@v1
147-
# with:
148-
# action: retrieve
149-
150-
# - name: Run GasCompare
151-
# run: |
152-
# npm run gasCompare /tmp/gasReporterOutput_Current.json /tmp/gasReporterOutput_Master.json

.github/workflows/release.yml

+26-17
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,31 @@
1-
name: Release
1+
name: Release Package
2+
23
on:
34
push:
4-
branches:
5-
- "next"
5+
tags:
6+
- v*
67
jobs:
7-
build:
8+
publish-npm-package:
89
runs-on: ubuntu-latest
910
steps:
10-
- uses: actions/checkout@v2
11-
with:
12-
persist-credentials: false
13-
- uses: actions/setup-node@v1
14-
with:
15-
node-version: "16.x"
16-
- run: yarn cp-ci-env
17-
- run: yarn install
18-
- run: yarn run hardhat export-abi
19-
- run: yarn semantic-release
20-
env:
21-
GITHUB_TOKEN: ${{ secrets.RAZORNETWORKBOT }}
22-
NPM_TOKEN: ${{ secrets.RAZORDEPLOYER }}
11+
- uses: actions/checkout@v3
12+
with:
13+
persist-credentials: false
14+
- uses: actions/setup-node@v3
15+
with:
16+
node-version: "20"
17+
registry-url: "https://registry.npmjs.org"
18+
- run: yarn cp-ci-env
19+
- run: |
20+
PKG_VERSION=$(node -p "require('./package.json').version")
21+
TAG_VERSION=${GITHUB_REF#refs/tags/v}
22+
if [ "$PKG_VERSION" != "$TAG_VERSION" ]; then
23+
echo "Package version ($PKG_VERSION) does not match tag version ($TAG_VERSION)"
24+
exit 1
25+
fi
26+
- run: yarn install
27+
- run: yarn run hardhat export-abi
28+
- run: npm publish
29+
env:
30+
GITHUB_TOKEN: ${{ secrets.RAZORNETWORKBOT }}
31+
NPM_TOKEN: ${{ secrets.RAZORDEPLOYER }}

0 commit comments

Comments
 (0)