Skip to content

Merge pull request #226 from ralexstokes/integrate-kurtosis #5

Merge pull request #226 from ralexstokes/integrate-kurtosis

Merge pull request #226 from ralexstokes/integrate-kurtosis #5

Workflow file for this run

name: Release suite
on:
push:
tags:
- v*
jobs:
extract-version:
runs-on: ubuntu-latest
steps:
- name: Extract version
run: echo "::set-output name=VERSION::$(echo ${GITHUB_REF#refs/tags/})"
id: extract_version
outputs:
VERSION: ${{ steps.extract_version.outputs.VERSION }}
build:
name: Build Release
strategy:
matrix:
arch: [x86_64-unknown-linux-gnu,
x86_64-apple-darwin]
include:
- arch: x86_64-unknown-linux-gnu
platform: ubuntu-latest
- arch: x86_64-apple-darwin
platform: macos-latest
runs-on: ${{ matrix.platform }}
needs: extract-version
steps:
- name: Checkout sources
uses: actions/checkout@v3
- name: Read toolchain file
id: rust-toolchain
run: |
RUST_TOOLCHAIN=$(grep 'channel' rust-toolchain.toml | awk '{split($0,a," = "); print a[2]}' | tr -d '"')
echo "RUST_TOOLCHAIN=$RUST_TOOLCHAIN" >> $GITHUB_OUTPUT
shell: bash
- name: Install toolchain
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ steps.rust-toolchain.outputs.RUST_TOOLCHAIN }}
# ==============================
# Build
# ==============================
- name: Build mev-rs
run: |
cargo install --path bin/mev --locked
mkdir artifacts
mv ~/.cargo/bin/mev ./artifacts
cd artifacts
tar -czf mev-rs-${{ needs.extract-version.outputs.VERSION }}-${{ matrix.arch }}.tar.gz mev
mv *tar.gz* ..
# =======================================================================
# Upload artifacts
# This is required to share artifacts between different jobs
# =======================================================================
- name: Upload artifact
uses: actions/upload-artifact@v2
with:
name: mev-rs-${{ needs.extract-version.outputs.VERSION }}-${{ matrix.arch }}.tar.gz
path: mev-rs-${{ needs.extract-version.outputs.VERSION }}-${{ matrix.arch }}.tar.gz
draft-release:
name: Draft Release
needs: [build, extract-version]
runs-on: ubuntu-latest
env:
VERSION: ${{ needs.extract-version.outputs.VERSION }}
steps:
# This is necessary for generating the changelog. It has to come before "Download Artifacts" or else it deletes the artifacts.
- name: Checkout sources
uses: actions/checkout@v3
with:
fetch-depth: 0
# ==============================
# Download artifacts
# ==============================
- name: Download artifacts
uses: actions/download-artifact@v2
# ==============================
# Create release draft
# ==============================
- name: Generate Full Changelog
id: changelog
run: echo "::set-output name=CHANGELOG::$(git log --pretty=format:"- %s" $(git describe --tags --abbrev=0 ${{ env.VERSION }}^)..${{ env.VERSION }})"
- name: Create Release Draft
env:
GITHUB_USER: ralexstokes
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# The formatting here is adapted from OpenEthereum: https://github.com/openethereum/openethereum/blob/main/.github/workflows/build.yml
run: |
body=$(cat <<- "ENDBODY"
${{ env.VERSION }}
## Changelog
${{ steps.changelog.outputs.CHANGELOG }}
## Binaries
| System | Architecture | Binary |
|:---:|:---:|:---:|
| <img src="https://simpleicons.org/icons/apple.svg" style="width: 32px;"/> | x86_64 | [mev-rs-${{ env.VERSION }}-x86_64-apple-darwin.tar.gz](https://github.com/${{ env.REPO_NAME }}/releases/download/${{ env.VERSION }}/mev-rs-${{ env.VERSION }}-x86_64-apple-darwin.tar.gz) |
| <img src="https://simpleicons.org/icons/linux.svg" style="width: 32px;"/> | x86_64 | [mev-rs-${{ env.VERSION }}-x86_64-unknown-linux-gnu.tar.gz](https://github.com/${{ env.REPO_NAME }}/releases/download/${{ env.VERSION }}/mev-rs-${{ env.VERSION }}-x86_64-unknown-linux-gnu.tar.gz) |
ENDBODY
)
assets=()
for asset in ./mev-rs-*.tar.gz*; do
assets+=("-a" "$asset/$asset")
done
tag_name="${{ env.VERSION }}"
echo "$body" | hub release create --draft "${assets[@]}" -F "-" "$tag_name"