Skip to content

dockerize job depends on check-version #101

dockerize job depends on check-version

dockerize job depends on check-version #101

Workflow file for this run

name: Release
on:
push:
tags:
- '*'
env:
SUBWASM_VERSION: 0.20.0
jobs:
check-version:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4.1.1
- id: check_version
run: |
VERSION=$(grep -m1 version Cargo.toml | sed -E 's/.*"(.*)".*/\1/')
TAG_NAME="${{ github.ref_name }}"
if echo "$TAG_NAME" | grep -qE '^v[0-9]+\.[0-9]+\.[0-9]+$'; then
echo "is_release_version=true" >> $GITHUB_OUTPUT
if [ "v$VERSION" == "$TAG_NAME" ]; then
echo "Proceeding with tag $TAG_NAME matching Cargo.toml version v$VERSION."
else
echo "Version in Cargo.toml ($VERSION) does not match current tag $TAG_NAME. Canceling release..."
exit 1
fi
else
echo "is_release_version=false" >> $GITHUB_OUTPUT
echo "Tag $TAG_NAME does not have the format 'v*.*.*'. Skipping version check and proceeding..."
fi
outputs:
is_release_version: ${{ steps.check_version.outputs.is_release_version }}
prepare-release:
needs: check-version
runs-on: ubuntu-latest
strategy:
matrix:
runtime:
- { name: "laos", package: "laos-runtime", path: "runtime/laos" }
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/setup
- uses: ./.github/actions/cache
with:
cache-key: build_and_push
- name: Srtool build
id: srtool_build
uses: chevdor/srtool-actions@v0.9.2
with:
chain: ${{ matrix.runtime.name }}
package: ${{ matrix.runtime.package }}
runtime_dir: ${{ matrix.runtime.path }}
tag: 1.74.0
- name: Summary
id: summary
run: |
echo '${{ steps.srtool_build.outputs.json }}' | jq . > ${{ matrix.runtime.name }}-srtool-digest.json
cat ${{ matrix.runtime.name }}-srtool-digest.json
echo "Runtime location: ${{ steps.srtool_build.outputs.wasm }}"
RUSTC_VERSION=$(jq '.info.rustc' < ${{ matrix.runtime.name }}-srtool-digest.json)
SRTOOL_VERSION=$(jq '.info.generator.version' < ${{ matrix.runtime.name }}-srtool-digest.json)
echo "rustc_version='$RUSTC_VERSION'" >> $GITHUB_OUTPUT
echo "srtool_version=$SRTOOL_VERSION" >> $GITHUB_OUTPUT
- name: Install subwasm ${{ env.SUBWASM_VERSION }}
run: |
wget https://github.com/chevdor/subwasm/releases/download/v${{ env.SUBWASM_VERSION }}/subwasm_linux_amd64_v${{ env.SUBWASM_VERSION }}.deb
sudo dpkg -i subwasm_linux_amd64_v${{ env.SUBWASM_VERSION }}.deb
subwasm --version
- name: Extract metadata
run: |
subwasm --json info ${{ steps.srtool_build.outputs.wasm }} > ${{ matrix.runtime.name }}-info.json
subwasm info ${{ steps.srtool_build.outputs.wasm }} > ${{ matrix.runtime.name }}-info.txt
cat ${{ matrix.runtime.name }}-info.txt
subwasm --json info ${{ steps.srtool_build.outputs.wasm_compressed }} > ${{ matrix.runtime.name }}-subwam-info.json
subwasm info ${{ steps.srtool_build.outputs.wasm_compressed }} > ${{ matrix.runtime.name }}-subwam-info.txt
cat ${{ matrix.runtime.name }}-subwam-info.txt
- name: Update Release Description with subwasm info
run: |
gh release view ${{ github.ref_name }} --json body -q .body > description.txt
RUSTC_VERSION=$(echo ${{ steps.summary.outputs.rustc_version }} | tr -d '"')
SRTOOL_VERSION=${{ steps.summary.outputs.srtool_version }}
printf "\n\n## ${{ matrix.runtime.name }} runtime\nThis runtime was built using %s with srtool %s\n" "$RUSTC_VERSION" "$SRTOOL_VERSION" >> description.txt
echo '```' >> description.txt
cat ${{ matrix.runtime.name }}-subwam-info.txt >> description.txt
echo '```' >> description.txt
gh release edit ${{ github.ref_name }} --notes-file description.txt
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Upload Ownership Wasm Binaries
run: |
echo "Uploading ownership wasm binary for tag ${{ github.ref_name }}"
gh release upload ${{ github.ref_name }} ${{ steps.srtool_build.outputs.wasm_compressed }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
dockerize_and_push:
needs: check-version
runs-on:
group: laos
labels: ubuntu-16-cores
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/setup
- uses: ./.github/actions/cache
with:
cache-key: build_and_push
- name: Build
run: |
cargo build --release --locked
- name: Log in to Docker Hub
uses: docker/login-action@v2.1.0
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_TOKEN }}
- name: Push image of laos node
uses: docker/build-push-action@v4
with:
context: .
push: true
file: ./docker/laos-node.local.Dockerfile
tags: freeverseio/laos-node:${{ github.ref_name }}