Skip to content

Release 6400 testnets (#1220) #113

Release 6400 testnets (#1220)

Release 6400 testnets (#1220) #113

Workflow file for this run

name: Release
on:
push:
tags:
- "v*"
- "pango*"
env:
CARGO_TERM_COLOR: always
DOCKER_REGISTRY: ghcr.io
# WARNING: If you upgrade this version, you need also provide a new srtool image tag same with this.
RUST_TOOLCHAIN: nightly-2023-05-22
jobs:
build-package:
name: Build package
runs-on: ubuntu-latest
container:
image: ubuntu:20.04
strategy:
matrix:
artifact:
- type: mainnets
features: darwinia-native,crab-native
enable_tar_bz2: true
- type: mainnets
features: darwinia-native,crab-native,evm-tracing
suffix: tracing
enable_tar_bz2: false
- type: testnets
features: pangoro-native,pangolin-native
enable_tar_bz2: true
- type: testnets
features: pangoro-native,pangolin-native,evm-tracing
suffix: tracing
enable_tar_bz2: false
steps:
- name: Fetch latest code
uses: actions/checkout@v3
- uses: actions/checkout@v3
with:
repository: darwinia-network/devops
path: .github/actions
- uses: ./.github/actions/actions/fast-substrate
name: Build testnets
id: build-testnets
if: ${{ startsWith(github.ref, 'refs/tags/pango') && (matrix.artifact.type == 'testnets') }}
with:
package: darwinia
rust_toolchain: ${{ env.RUST_TOOLCHAIN }}
features: ${{ matrix.artifact.features }}
suffix: ${{ matrix.artifact.suffix }}
enable_tar_bz2: ${{ matrix.artifact.enable_tar_bz2 }}
- uses: ./.github/actions/actions/fast-substrate
name: Build mainnets
id: build-mainnets
if: ${{ startsWith(github.ref, 'refs/tags/v') && (matrix.artifact.type == 'mainnets') }}
with:
package: darwinia
features: ${{ matrix.artifact.features }}
suffix: ${{ matrix.artifact.suffix }}
- name: Upload shared
uses: actions/upload-artifact@v3
with:
name: darwinia-artifact
path: build
- name: Fail fast
uses: vishnudxb/[email protected]
if: failure()
with:
repo: darwinia-network/darwinia
workflow_id: ${{ github.run_id }}
access_token: ${{ github.token }}
build-runtimes:
name: Build runtimes
runs-on: ubuntu-latest
strategy:
matrix:
runtime:
- darwinia
- crab
- pangolin
- pangoro
steps:
- name: Fetch latest code
uses: actions/checkout@v3
- name: Install deps
env:
GOMPLATE_VERSION: v3.11.4
run: |
BIN_PATH=$HOME/.local/bin
mkdir -p ${BIN_PATH}
# gomplate
curl -L -o ${BIN_PATH}/gomplate \
https://github.com/hairyhenderson/gomplate/releases/download/${GOMPLATE_VERSION}/gomplate_linux-amd64
chmod +x ${BIN_PATH}/gomplate
- name: Build ${{ matrix.runtime }} runtime
id: srtool_build
uses: chevdor/[email protected]
env:
# https://github.com/chevdor/srtool-actions/blob/89fe4b5285f6ca2212adcbb2726a2860e8d56d12/action.yml#LL123C54-L123C54
AUTHORIZE_UPGRADE_PREFIX: "0x02"
with:
image: ghcr.io/darwinia-network/devops/srtool
tag: ${{ env.RUST_TOOLCHAIN }}
chain: ${{ matrix.runtime }}
- name: Prepare artifact
run: |
mkdir -p build
echo '${{ steps.srtool_build.outputs.json }}' | jq > build/${{ matrix.runtime }}-srtool.json
cp ${{ steps.srtool_build.outputs.wasm_compressed }} build/
export CHAIN=${{ matrix.runtime }}
cat .github/template-runtime.md \
| gomplate -d srtool=build/${{ matrix.runtime }}-srtool.json \
> build/release-template-${{ matrix.runtime }}.md
- name: Upload ${{ matrix.runtime }} wasm
uses: actions/upload-artifact@v3
with:
name: darwinia-artifact
path: build
- name: Fail fast
uses: vishnudxb/[email protected]
if: failure()
with:
repo: darwinia-network/darwinia
workflow_id: ${{ github.run_id }}
access_token: ${{ github.token }}
build-docker-image:
name: Build Docker image
runs-on: ubuntu-latest
needs: [build-package]
steps:
- name: Fetch latest code
uses: actions/checkout@v3
- name: Download artifact
uses: actions/download-artifact@v3
with:
name: darwinia-artifact
path: build
- name: Tag
uses: olegtarasov/[email protected]
- name: Sha
uses: benjlevesque/[email protected]
- name: Docker login
uses: docker/login-action@v1
with:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
registry: ${{ env.DOCKER_REGISTRY }}
- name: Extract shared
run: |
mkdir -p dist
tar -xvf build/darwinia-x86_64-linux-gnu.tar.bz2 -C dist/
- name: Publish docker image
uses: docker/build-push-action@v3
with:
push: true
context: .
file: .maintain/docker/Dockerfile
tags: ${{ env.DOCKER_REGISTRY }}/${{ github.repository }}:sha-${{ env.SHA }}
- name: Publish docker image with tag
uses: docker/build-push-action@v3
if: startsWith(github.ref, 'refs/tags/v') || startsWith(github.ref, 'refs/tags/pango')
with:
push: true
context: .
file: .maintain/docker/Dockerfile
tags: ${{ env.DOCKER_REGISTRY }}/${{ github.repository }}:${{ env.GIT_TAG_NAME }}
release:
name: Release
runs-on: ubuntu-latest
needs: [build-package, build-runtimes, build-docker-image]
steps:
- name: Fetch latest code
uses: actions/checkout@v3
- name: Download artifact
uses: actions/download-artifact@v2
with:
name: darwinia-artifact
path: build
- name: Install deps
env:
GOMPLATE_VERSION: v3.11.4
run: |
BIN_PATH=$HOME/.local/bin
mkdir -p ${BIN_PATH}
# gomplate
curl -L -o ${BIN_PATH}/gomplate \
https://github.com/hairyhenderson/gomplate/releases/download/${GOMPLATE_VERSION}/gomplate_linux-amd64
chmod +x ${BIN_PATH}/gomplate
- name: Tag
uses: olegtarasov/[email protected]
- name: Sha
uses: benjlevesque/[email protected]
- name: Prepare artifacts
run: |
mkdir -p deploy
mv build/*.tar.bz2 deploy/
mv build/*.tar.zst deploy/
- name: Prepare release template
run: |
export RELEASE_SCHEMA='{"tag": "'$GIT_TAG_NAME'", "sha": "'$SHA'"}'
cat .github/template-release.md \
| gomplate -d schema='env:/RELEASE_SCHEMA?type=application/json' \
> template-release.tmp.md
- name: Fill mainnets release
if: startsWith(github.ref, 'refs/tags/v')
run: |
mv build/darwinia* deploy/
mv build/crab* deploy/
cat build/release-template-darwinia.md >> template-release.md
cat build/release-template-crab.md >> template-release.md
cat template-release.tmp.md >> template-release.md
- name: Fill testnets release
if: startsWith(github.ref, 'refs/tags/pango')
run: |
mv build/pangolin* deploy/
mv build/pangoro* deploy/
cat build/release-template-pangolin.md >> template-release.md
cat build/release-template-pangoro.md >> template-release.md
cat template-release.tmp.md >> template-release.md
- name: Hash file
run: cd deploy && sha256sum * | tee sha256sums.txt
# - name: Verify
# run: |
# set -xe
# cat template-release.md
# ls -la deploy/
# cat build/*.md
- name: Publish github release
if: startsWith(github.ref, 'refs/tags/v')
uses: softprops/action-gh-release@v1
with:
body_path: "template-release.md"
files: |
deploy/*
generate_release_notes: true
token: ${{ secrets.GITHUB_TOKEN }}
- name: Publish github release
if: startsWith(github.ref, 'refs/tags/pango')
uses: softprops/action-gh-release@v1
with:
body_path: "template-release.md"
files: |
deploy/*
generate_release_notes: true
token: ${{ secrets.GITHUB_TOKEN }}
prerelease: true
deploy-tracing-node:
name: Deploy tracing node
runs-on: ubuntu-latest
needs: [release]
steps:
- name: Fetch latest code
uses: actions/checkout@v3
- name: Tag
uses: olegtarasov/[email protected]
- name: Deploy testnets tracing node
if: startsWith(github.ref, 'refs/tags/pango')
env:
GITHUB_TOKEN: ${{ secrets.GH_TKN_DARWINIA }}
run: |
gh workflow run \
trigger-tracing-node.yml \
--ref=main \
--repo=darwinia-network/devops \
--raw-field=type=testnets \
--raw-field="version=$GIT_TAG_NAME"
clean-artifacts:
name: Clean artifacts
runs-on: ubuntu-latest
needs: [release]
if: always()
steps:
- uses: geekyeggo/delete-artifact@v1
with:
name: darwinia-artifact