This repository has been archived by the owner on May 15, 2024. It is now read-only.
* Updated toolchain #187
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: Release | |
on: | |
push: | |
branches: | |
- release/[0-9]+.[0-9]+.[0-9]+-?[a-z]* | |
tags: | |
- v[0-9]+.[0-9]+.[0-9]+-?[a-z]* | |
env: | |
CARGO_TERM_COLOR: always | |
jobs: | |
release-check: | |
if: startsWith(github.ref, 'refs/heads/release') | |
name: Check for release | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
runtime: [ajuna] | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Get crate and release versions | |
run: | | |
echo "CRATE_VERSIONS=$(cargo tree --depth=0 --workspace | egrep -o '[0-9]+\.[0-9]+\.[0-9]+' | uniq)" >> $GITHUB_ENV | |
echo "RELEASE_VERSION=${GITHUB_REF_NAME#release/}" >> $GITHUB_ENV | |
- name: Check release version is bumped | |
run: | | |
[ -z "$(git tag --list)" ] && { | |
echo "skipping as there are no tags yet" | |
exit 0 | |
} | |
TAG=$(git describe --tags --abbrev=0 | tr -d v) | |
echo "previous release version: $TAG" | |
echo "current release version: ${{ env.RELEASE_VERSION }}" | |
[ $TAG -eq ${{ env.RELEASE_VERSION }} ] && { | |
echo "release version must be bumped" | |
exit 1 | |
} | |
exit 0 | |
- name: Check crate and release versions match | |
run: | | |
[ $(echo ${{ env.CRATE_VERSIONS }} | wc -w | xargs) -ne 1 ] && { | |
echo "all crate versions should be equal" | |
exit 1 | |
} | |
[ "${{ env.CRATE_VERSIONS }}" != "${{ env.RELEASE_VERSION }}" ] && { | |
echo "release version (${{ env.CRATE_VERSIONS }}) is not equal to crate versions (${{ env.CRATE_VERSIONS }})" | |
exit 1 | |
} | |
echo "crate version: ${{ env.CRATE_VERSIONS }}" | |
echo "release version: ${{ env.RELEASE_VERSION }}" | |
exit 0 | |
- name: Check spec version match | |
run: | | |
RELEASE_VERSION=$(echo ${{ env.RELEASE_VERSION }} | tr -d .) | |
RELEASE_VERSION_INTEGER=$((10#$RELEASE_VERSION)) | |
SPEC_VERSION=$(grep "spec_version" runtime/${{ matrix.runtime }}/**/lib.rs | egrep -o "[0-9]+") | |
echo "release version as integer: $RELEASE_VERSION_INTEGER" | |
echo "spec version: $SPEC_VERSION" | |
[ "$RELEASE_VERSION_INTEGER" != "$SPEC_VERSION" ] && { | |
echo "spec version doesn't match release version" | |
exit 1 | |
} | |
exit 0 | |
- run: sudo apt-get install -y protobuf-compiler | |
- name: Check wasm build | |
run: cargo check --all-features --all-targets --release -p ${{ matrix.runtime }}-runtime | |
release: | |
if: startsWith(github.ref, 'refs/tags/v') | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
runtime: [ajuna] | |
env: | |
SUBWASM_VERSION: v0.19.1 | |
steps: | |
- uses: actions/checkout@v3 | |
- id: srtool_build | |
uses: chevdor/[email protected] | |
with: | |
image: paritytech/srtool | |
chain: ${{ matrix.runtime }} | |
tag: 1.74.1 | |
- name: Install subwasm {{ env.SUBWASM_VERSION }} | |
run: | | |
wget https://github.com/chevdor/subwasm/releases/download/${{ env.SUBWASM_VERSION }}/subwasm_linux_amd64_${{ env.SUBWASM_VERSION }}.deb -O subwasm.deb | |
sudo dpkg -i subwasm.deb | |
- name: Run subwasm info | |
run: | | |
echo "\`\`\`" > ${{ matrix.runtime }}-info.txt | |
echo -e "${{ matrix.runtime }}-runtime:\n" >> ${{ matrix.runtime }}-info.txt | |
subwasm info ${{ steps.srtool_build.outputs.wasm_compressed }} \ | |
| sed -E 's/^Running subwasm.+$//' \ | |
| sed '/^$/d' \ | |
>> ${{ matrix.runtime }}-info.txt | |
echo "\`\`\`" >> ${{ matrix.runtime }}-info.txt | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: ${{ matrix.runtime }}-artifact | |
path: | | |
${{ steps.srtool_build.outputs.wasm_compressed }} | |
${{ matrix.runtime }}-info.txt | |
if-no-files-found: error | |
release-draft: | |
needs: release | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/download-artifact@v3 | |
- run: | | |
echo "## Subwasm Info" > runtime-info.txt | |
cat **/*-info.txt >> runtime-info.txt | |
echo "---" >> runtime-info.txt | |
- name: Release | |
uses: softprops/action-gh-release@v1 | |
with: | |
draft: true | |
generate_release_notes: true | |
append_body: true | |
body_path: runtime-info.txt | |
files: "**/*_runtime.compact.compressed.wasm" | |
release-docker: | |
if: startsWith(github.ref, 'refs/tags/v') | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
image: | |
- { | |
name: parachain-ajuna, | |
build_arg_feature: ajuna, | |
build_arg_bin: ajuna-para, | |
} | |
outputs: | |
image_tag: ${{ steps.set_image_tag.outputs.image_tag }} | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: docker/setup-buildx-action@v2 | |
- uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKER_HUB_USERNAME }} | |
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} | |
- uses: docker/metadata-action@v4 | |
id: meta | |
with: | |
images: ${{ matrix.image.name }} | |
- name: Get image tag from the tag name | |
id: set_image_tag | |
run: | | |
IMAGE_TAG="${GITHUB_REF#refs/tags/v}" | |
echo "image_tag=$IMAGE_TAG" >> $GITHUB_ENV | |
echo "image_tag=$IMAGE_TAG" >> $GITHUB_OUTPUT | |
- uses: docker/build-push-action@v3 | |
with: | |
context: . | |
file: docker/Dockerfile | |
push: true | |
tags: | | |
ajuna/${{ matrix.image.name }}:${{ env.image_tag }} | |
ajuna/${{ matrix.image.name }}:latest | |
build-args: | | |
features=${{ matrix.image.build_arg_feature }} | |
bin=${{ matrix.image.build_arg_bin }} | |
cache-from: type=registry,ref=ajuna/${{ matrix.image.name }}:buildcache | |
cache-to: type=registry,ref=ajuna/${{ matrix.image.name }}:buildcache,mode=max |