Skip to content

Merge develop to v2.2.0 #856

Merge develop to v2.2.0

Merge develop to v2.2.0 #856

Workflow file for this run

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
if: github.event_name != 'pull_request' || github.event.pull_request.merged == true
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:
name: data
path: proxy/data
- name: Create Release
uses: ncipollo/release-action@v1
with:
tag: ${{ env.VERSION }}
prerelease: ${{ env.PRERELEASE }}
artifacts: "proxy/predeployed/dist/*,\
proxy/predeployed/data/*,\
proxy/data/ima-schain-*-manifest.json,\
proxy/data/*-abi.json"
- name: Build and publish image
working-directory: ./
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
with:
name: data
- name: Commit ABI
uses: EndBug/add-and-commit@v9
with:
default_author: github_actions
message: "Add ABI for version ${{ env.VERSION }}"
add: "*-abi.json"