Add commit reference #870
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: publish | |
# cspell:words PYPI_TOKEN ncipollo | |
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 }} | |
outputs: | |
version: ${{ steps.version.outputs.version }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- name: Install NODE JS | |
uses: actions/setup-node@v4 | |
with: | |
node-version: ${{ env.NODE_VERSION }} | |
cache: 'yarn' | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ env.PYTHON_VERSION }} | |
cache: 'pip' | |
cache-dependency-path: predeployed/test/requirements.txt | |
- 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 | |
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: 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: data | |
- name: Create Release | |
uses: ncipollo/release-action@v1 | |
with: | |
tag: ${{ env.VERSION }} | |
commit: "$GITHUB_SHA" | |
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 | |
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" |