Skip to content

Feat/get (#602)

Feat/get (#602) #74

Workflow file for this run

name: CD
on:
push:
tags:
- "[v]?[0-9]+.[0-9]+.[0-9]+"
jobs:
publish:
name: Publishing for ${{ matrix.job.os }}
runs-on: ${{ matrix.job.os }}
strategy:
matrix:
rust: [nightly]
job:
- os: ubuntu-latest
os-name: linux
target: x86_64-unknown-linux-gnu
architecture: x86_64
binary-postfix: ""
use-cross: false
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
submodules: recursive
- name: Install Rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: ${{ matrix.rust }}
profile: minimal
override: true
- uses: Swatinem/rust-cache@v2
- name: Setup build env
run: |
ROOT_DIR=`pwd`
sudo apt-get install protobuf-compiler
cargo install cargo-edit
cd ${ROOT_DIR}/metadata && yarn install && npx hardhat compile
test -e ${ROOT_DIR}/metadata/artifacts/contracts/DB3MetaStore.sol/DB3MetaStore.json && cp -f ${ROOT_DIR}/metadata/artifacts/contracts/DB3MetaStore.sol/DB3MetaStore.json ${ROOT_DIR}/abi/
test -e ${ROOT_DIR}/metadata/artifacts/contracts/libraries/Events.sol/Events.json && cp -f ${ROOT_DIR}/metadata/artifacts/contracts/libraries/Events.sol/Events.json ${ROOT_DIR}/abi/
cd ${ROOT_DIR}
TAG=${GITHUB_REF/refs\/tags\//}
VERSION=${TAG#*v}
echo ${VERSION}
cargo set-version --workspace ${VERSION}
- name: Cargo build
uses: actions-rs/cargo@v1
with:
command: build
use-cross: ${{ matrix.job.use-cross }}
toolchain: ${{ matrix.rust }}
args: --release --target ${{ matrix.job.target }}
- name: Packaging final binary
shell: bash
run: |
cd target/${{ matrix.job.target }}/release
TAG=${GITHUB_REF/refs\/tags\//}
VERSION=${TAG#*v}
RELEASE_NAME=db3-${GITHUB_REF/refs\/tags\//}-${{ matrix.job.os-name }}-${{ matrix.job.architecture }}
mkdir -p $RELEASE_NAME/bin
DB3_BINARY_NAME=db3
mv $DB3_BINARY_NAME $TM_BINARY_NAME $RELEASE_NAME/bin/
tar czvf $RELEASE_NAME.tar.gz $RELEASE_NAME
shasum -a 256 $RELEASE_NAME.tar.gz > $RELEASE_NAME.sha256
- name: Releasing assets
uses: softprops/action-gh-release@v1
with:
files: |
target/${{ matrix.job.target }}/release/db3*.tar.gz
target/${{ matrix.job.target }}/release/db3*.sha256
env:
GITHUB_TOKEN: ${{ secrets.CR_PAT }}