-
Notifications
You must be signed in to change notification settings - Fork 17
145 lines (118 loc) · 3.59 KB
/
publish.yml
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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
name: Build and publish
on:
pull_request:
types: [closed]
branches:
- 'v*.*.*'
- develop
- beta
- stable
push:
tags:
- 'custom-release-*'
env:
NODE_VERSION: 18
PYTHON_VERSION: 3.8
jobs:
build:
runs-on: ubuntu-latest
env:
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
defaults:
run:
working-directory: proxy
outputs:
version: ${{ steps.version.outputs.version }}
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Install NODE JS
uses: actions/setup-node@v3
with:
node-version: ${{ env.NODE_VERSION }}
cache: 'yarn'
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: ${{ env.PYTHON_VERSION }}
cache: 'pip'
- name: Prepare for pip package building
run: |
python3 -m pip install --upgrade build
python3 -m pip install --user --upgrade twine
- name: Install project
run: yarn install
- name: Calculate version
id: version
working-directory: /
run: |
export BRANCH=${GITHUB_REF##*/}
echo "Branch $BRANCH"
export VERSION=$(bash ./scripts/calculate_version.sh)
echo "VERSION=$VERSION" >> $GITHUB_ENV
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
echo "Version $VERSION"
( test $BRANCH = "stable" && export PRERELEASE=false ) || export PRERELEASE=true
echo "PRERELEASE=$PRERELEASE" >> $GITHUB_ENV
- name: Generate Manifest
run: npx hardhat run migrations/generateManifest.ts
- name: Install python testing staff
run: pip3 install -r predeployed/test/requirements.txt
- name: Build predeployed pip package
env:
VERSION: ${{ env.VERSION }}
run: ./predeployed/scripts/build_package.sh
- name: Publish predeployed pip package
env:
PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}
run: ./predeployed/scripts/publish_package.sh
- name: Generate mainnet ABIs
env:
VERSION: ${{ env.VERSION }}
run: npx hardhat run scripts/generateAbi.ts
- name: Generate predeployed ABIs
working-directory: proxy/predeployed
env:
VERSION: ${{ env.VERSION }}
run: |
python3 -m venv scripts/venv
source scripts/venv/bin/activate
pip install dist/ima_predeployed-*.whl
mkdir data
python scripts/generate_abi.py > data/ima-$VERSION-predeployed-abi.json
- name: Store artifacts
uses: actions/upload-artifact@v4
with:
path: data
- name: Create Release
uses: ncipollo/release-action@v1
with:
tag: ${{ env.VERSION }}
prerelease: ${{ env.PRERELEASE }}
artifacts: "predeployed/dist/,predeployed/data/,data/ima-schain-*-manifest.json,data/*-abi.json"
- name: Build and publish image
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
run: scripts/build_and_publish_image.sh
abi:
runs-on: ubuntu-latest
needs:
build
env:
VERSION: ${{ needs.build.outputs.version }}
steps:
- uses: actions/checkout@v4
with:
ref: abi
- name: Load artifacts
uses: actions/download-artifact@v4
- name: Commit ABI
uses: EndBug/add-and-commit@v9
with:
default_author: github_actions
message: "Add ABI for version ${{ env.VERSION }}"
add: "*-abi.json"