Skip to content

v0.8.1 (#83)

v0.8.1 (#83) #37

Workflow file for this run

name: Release
on:
push:
branches:
- release/[0-9]+.[0-9]+.[0-9]
# Matches branches containing an arbitrary suffix starting with '-'.
- release/[0-9]+.[0-9]+.[0-9]+-*
tags:
- v[0-9]+.[0-9]+.[0-9]
# Matches tags containing an arbitrary suffix starting with '-'.
- v[0-9]+.[0-9]+.[0-9]+-*
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: [ bajun ]
steps:
- uses: actions/checkout@v4
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"
exit 0