|
1 |
| -name: Release |
| 1 | +name: Release Flow |
2 | 2 |
|
3 |
| -# Triggered on pushing a tag |
| 3 | +# Controls when the action will run. |
4 | 4 | on:
|
5 |
| - push: |
6 |
| - tags: |
7 |
| - - "v*.*.*" |
| 5 | + release: |
| 6 | + types: [published] |
| 7 | + workflow_dispatch: # TODO: Remove after testing |
8 | 8 |
|
9 | 9 | jobs:
|
10 |
| - # PyInstaller job for both x64 and arm64 binaries |
11 |
| - build-macos-pyinstaller: |
12 |
| - runs-on: ${{ matrix.os }} |
| 10 | + publish-pip-packages: |
| 11 | + name: Publish the package on PyPi |
13 | 12 | strategy:
|
14 | 13 | matrix:
|
15 |
| - os: [macos-14, macos-14-large] |
16 |
| - |
17 |
| - steps: |
18 |
| - - uses: actions/checkout@v3 |
19 |
| - |
20 |
| - # Set up Python with setup-python action and add it to PATH |
21 |
| - - uses: actions/setup-python@v5 |
22 |
| - id: setup-python |
23 |
| - with: |
24 |
| - python-version: "3.10" |
25 |
| - |
26 |
| - # Install Poetry and its dependencies |
27 |
| - - name: Install and configure Poetry |
28 |
| - uses: snok/install-poetry@v1 |
29 |
| - with: |
30 |
| - version: "1.4.0" |
31 |
| - virtualenvs-create: true |
32 |
| - virtualenvs-in-project: false |
33 |
| - virtualenvs-path: ~/my-custom-path |
34 |
| - installer-parallel: true |
35 |
| - |
36 |
| - # Set OS_ARCH env |
37 |
| - - name: Set architecture environment variable |
38 |
| - run: | |
39 |
| - if [ "${{ matrix.os }}" == "macos-14-large" ]; then |
40 |
| - echo "OS_ARCH=x64" >> $GITHUB_ENV; |
41 |
| - else |
42 |
| - echo "OS_ARCH=arm64" >> $GITHUB_ENV; |
43 |
| - fi |
44 |
| -
|
45 |
| - # Cache Poetry dependencies with unique key for each environment and architecture |
46 |
| - - name: Cache Poetry dependencies |
47 |
| - uses: actions/cache@v3 |
48 |
| - with: |
49 |
| - path: | |
50 |
| - ~/.cache/pypoetry |
51 |
| - ~/.cache/pip |
52 |
| - ~/.venv |
53 |
| - key: poetry-${{ env.OS_ARCH }}-${{ hashFiles('**/poetry.lock') }} |
54 |
| - restore-keys: | |
55 |
| - poetry-${{ env.OS_ARCH }}- |
56 |
| -
|
57 |
| - - name: Install dependencies |
58 |
| - run: poetry install |
59 |
| - |
60 |
| - # Download and build with PyInstaller |
61 |
| - - name: Get trader bin |
62 |
| - run: | |
63 |
| - trader_version=$(poetry run python -c "import yaml; config = yaml.safe_load(open('templates/trader.yaml')); print(config['service_version'])") |
64 |
| - echo $trader_version |
65 |
| - make ./dist/aea_bin |
66 |
| - #instead of this one mwe use make; mkdir dist && curl -L -o dist/aea_bin "https://github.com/valory-xyz/trader/releases/download/${trader_version}/trader_bin_${{ env.OS_ARCH }}" |
67 |
| - |
68 |
| - - name: Build with PyInstaller |
69 |
| - run: | |
70 |
| - poetry run pyinstaller operate/services/utils/tendermint.py --onefile --name tendermint_mac |
71 |
| -
|
72 |
| - # patch open aea in place |
73 |
| - rm -fr ./open-aea |
74 |
| - git clone https://github.com/valory-xyz/open-aea.git -b fix/1.5.2_encoding |
75 |
| - poetry run pip install ./open-aea/ |
76 |
| -
|
77 |
| - poetry run pyinstaller --collect-data eth_account --collect-all aea --collect-all autonomy --collect-all operate --collect-all aea_ledger_ethereum --collect-all aea_ledger_cosmos --collect-all aea_ledger_ethereum_flashbots --hidden-import aea_ledger_ethereum --hidden-import aea_ledger_cosmos --hidden-import aea_ledger_ethereum_flashbots operate/pearl.py --add-binary dist/aea_bin:. --add-binary dist/tendermint_mac:. --onefile --name pearl_${{ env.OS_ARCH }} |
78 |
| -
|
79 |
| - - name: Upload Release Assets |
80 |
| - uses: actions/upload-artifact@v4 |
81 |
| - with: |
82 |
| - name: pearl_${{ env.OS_ARCH }} |
83 |
| - path: dist/pearl_${{ env.OS_ARCH }} |
84 |
| - |
85 |
| - # Jobs for production and development, running separately for x64 and arm64 |
86 |
| - build-release: |
| 14 | + os: [ubuntu-latest] |
| 15 | + python-version: ["3.10"] |
87 | 16 | runs-on: ${{ matrix.os }}
|
88 |
| - strategy: |
89 |
| - matrix: |
90 |
| - env: [production, development] |
91 |
| - os: [macos-14, macos-14-large] |
92 |
| - |
93 |
| - needs: build-macos-pyinstaller |
94 |
| - |
95 | 17 | steps:
|
96 |
| - - uses: actions/checkout@v3 |
97 |
| - |
98 |
| - - uses: actions/setup-node@v4 |
| 18 | + - uses: actions/checkout@master |
| 19 | + - uses: actions/setup-python@v3 |
99 | 20 | with:
|
100 |
| - node-version: "20.x" |
101 |
| - registry-url: "https://registry.npmjs.org" |
102 |
| - |
103 |
| - # Configure Yarn network settings for timeout, retries, and reduced concurrency |
104 |
| - - name: Configure Yarn network settings |
105 |
| - run: | |
106 |
| - yarn config set network-timeout 60000 # Set network timeout to 1 minute |
107 |
| - yarn config set network-retries 10 # Retry up to 10 times |
108 |
| - yarn config set network-concurrency 2 # Reduce concurrency to 2 connections |
109 |
| - |
110 |
| - # Set OS_ARCH env |
111 |
| - - name: Set architecture environment variable |
| 21 | + python-version: ${{ matrix.python-version }} |
| 22 | + - name: Install dependencies |
112 | 23 | run: |
|
113 |
| - if [ "${{ matrix.os }}" == "macos-14-large" ]; then |
114 |
| - echo "OS_ARCH=x64" >> $GITHUB_ENV; |
115 |
| - else |
116 |
| - echo "OS_ARCH=arm64" >> $GITHUB_ENV; |
117 |
| - fi |
118 |
| - # Download the appropriate architecture artifact |
119 |
| - - name: Download Pearl binary for architecture |
120 |
| - uses: actions/download-artifact@v4 |
121 |
| - with: |
122 |
| - name: pearl_${{ env.OS_ARCH }} |
123 |
| - path: electron/bins/ |
124 |
| - |
125 |
| - # download TM |
126 |
| - - name: Set architecture environment variable |
| 24 | + sudo apt-get update --fix-missing |
| 25 | + sudo apt-get autoremove |
| 26 | + sudo apt-get autoclean |
| 27 | + python -m pip install --upgrade pip |
| 28 | + poetry install |
| 29 | + python --version |
| 30 | +
|
| 31 | + - name: Build wheels and source tarball |
127 | 32 | run: |
|
128 |
| - |
129 |
| - if [ "${{ matrix.os }}" == "macos-14-large" ]; then |
130 |
| - export TM_DOWNLOAD_URL=https://github.com/tendermint/tendermint/releases/download/v0.34.19/tendermint_0.34.19_darwin_amd64.tar.gz |
131 |
| - else |
132 |
| - export TM_DOWNLOAD_URL=https://github.com/tendermint/tendermint/releases/download/v0.34.19/tendermint_0.34.19_darwin_arm64.tar.gz |
133 |
| - fi |
134 |
| - curl $TM_DOWNLOAD_URL -L -o tendermint.tar.gz |
135 |
| - tar -xvf tendermint.tar.gz |
136 |
| - cp ./tendermint electron/bins/tendermint |
137 |
| - chmod +x electron/bins/tendermint |
| 33 | + echo Processing olas-operate-middleware |
| 34 | + poetry run python -m build |
138 | 35 |
|
139 |
| - # Add execution permissions to the binaries |
140 |
| - - name: Add exec permissions |
141 |
| - run: chmod +x electron/bins/pearl_${{ env.OS_ARCH }} |
142 |
| - |
143 |
| - # Cache electron node_modules with unique key for each environment and architecture |
144 |
| - - name: Restore electron node_modules cache |
145 |
| - id: cache-electron-node-modules |
146 |
| - uses: actions/cache@v3 |
| 36 | + - name: Publish olas-operate-middleware Framework to PyPI |
| 37 | + uses: pypa/gh-action-pypi-publish@release/v1 |
147 | 38 | with:
|
148 |
| - path: node_modules |
149 |
| - key: electron-node-modules-${{ runner.os }}-${{ env.OS_ARCH }}-${{ matrix.env }}-${{ hashFiles('yarn.lock') }} |
150 |
| - |
151 |
| - # Install electron dependencies if cache miss |
152 |
| - - name: Install electron dependencies |
153 |
| - if: steps.cache-electron-node-modules.outputs.cache-hit != 'true' |
154 |
| - run: yarn install |
155 |
| - |
156 |
| - # Cache frontend node_modules with unique key for each environment and architecture |
157 |
| - - name: Restore frontend node_modules cache |
158 |
| - id: cache-frontend-node-modules |
159 |
| - uses: actions/cache@v3 |
160 |
| - with: |
161 |
| - path: frontend/node_modules |
162 |
| - key: frontend-node-modules-${{ runner.os }}-${{ env.OS_ARCH }}-${{ matrix.env }}-${{ hashFiles('frontend/yarn.lock') }} |
163 |
| - |
164 |
| - # Install frontend dependencies if cache miss |
165 |
| - - name: Install frontend dependencies |
166 |
| - if: steps.cache-frontend-node-modules.outputs.cache-hit != 'true' |
167 |
| - run: yarn install:frontend |
168 |
| - |
169 |
| - # Build frontend for production |
170 |
| - - name: Build frontend for production |
171 |
| - if: matrix.env == 'production' |
172 |
| - run: yarn build:frontend |
173 |
| - env: |
174 |
| - NODE_ENV: ${{ matrix.env }} |
175 |
| - DEV_RPC: https://rpc-gate.autonolas.tech/gnosis-rpc/ |
176 |
| - IS_STAGING: ${{ github.ref != 'refs/heads/main' && 'true' || 'false' }} |
177 |
| - FORK_URL: https://rpc-gate.autonolas.tech/gnosis-rpc/ |
178 |
| - |
179 |
| - # Build frontend for development |
180 |
| - - name: Build frontend for development |
181 |
| - if: matrix.env == 'development' |
182 |
| - run: yarn build:frontend |
183 |
| - env: |
184 |
| - NODE_ENV: ${{ matrix.env }} |
185 |
| - DEV_RPC: https://virtual.gnosis.rpc.tenderly.co/80ff70d1-71fd-4c9e-9402-913f0c4c58b0 |
186 |
| - IS_STAGING: ${{ github.ref != 'refs/heads/main' && 'true' || 'false' }} |
187 |
| - FORK_URL: https://virtual.gnosis.rpc.tenderly.co/80ff70d1-71fd-4c9e-9402-913f0c4c58b0 |
188 |
| - |
189 |
| - # Run the build and notarization process for production |
190 |
| - - name: Build, notarize, and publish (Production) |
191 |
| - if: matrix.env == 'production' |
192 |
| - env: |
193 |
| - APPLE_APP_SPECIFIC_PASSWORD: ${{ secrets.APPLEIDPASS }} |
194 |
| - APPLE_ID: ${{ secrets.APPLEID }} |
195 |
| - APPLE_TEAM_ID: ${{ secrets.APPLETEAMID }} |
196 |
| - CSC_KEY_PASSWORD: ${{ secrets.CSC_KEY_PASSWORD }} |
197 |
| - CSC_LINK: ${{ secrets.CSC_LINK }} |
198 |
| - GH_TOKEN: ${{ secrets.github_token }} |
199 |
| - NODE_ENV: ${{ matrix.env }} |
200 |
| - ARCH: ${{ env.OS_ARCH }} |
201 |
| - DEV_RPC: https://rpc-gate.autonolas.tech/gnosis-rpc/ |
202 |
| - FORK_URL: https://rpc-gate.autonolas.tech/gnosis-rpc/ |
203 |
| - run: node build.js |
204 |
| - |
205 |
| - # Run the build and notarization process for development |
206 |
| - - name: Build, notarize, and publish (Development) |
207 |
| - if: matrix.env == 'development' |
208 |
| - env: |
209 |
| - APPLE_APP_SPECIFIC_PASSWORD: ${{ secrets.APPLEIDPASS }} |
210 |
| - APPLE_ID: ${{ secrets.APPLEID }} |
211 |
| - APPLE_TEAM_ID: ${{ secrets.APPLETEAMID }} |
212 |
| - CSC_KEY_PASSWORD: ${{ secrets.CSC_KEY_PASSWORD }} |
213 |
| - CSC_LINK: ${{ secrets.CSC_LINK }} |
214 |
| - GH_TOKEN: ${{ secrets.github_token }} |
215 |
| - NODE_ENV: ${{ matrix.env }} |
216 |
| - ARCH: ${{ env.OS_ARCH }} |
217 |
| - DEV_RPC: https://virtual.gnosis.rpc.tenderly.co/80ff70d1-71fd-4c9e-9402-913f0c4c58b0 |
218 |
| - FORK_URL: https://virtual.gnosis.rpc.tenderly.co/80ff70d1-71fd-4c9e-9402-913f0c4c58b0 |
219 |
| - run: | |
220 |
| - echo "DEV_RPC=https://virtual.gnosis.rpc.tenderly.co/80ff70d1-71fd-4c9e-9402-913f0c4c58b0" >> .env |
221 |
| - echo "FORK_URL=https://virtual.gnosis.rpc.tenderly.co/80ff70d1-71fd-4c9e-9402-913f0c4c58b0" >> .env |
222 |
| - node build.js |
| 39 | + user: __token__ |
| 40 | + password: ${{ secrets.PYPI_API_TOKEN }} |
| 41 | + skip_existing: true |
| 42 | + packages_dir: dist/ |
0 commit comments