Skip to content

Commit

Permalink
Try unify chain spec gen and runtime release creation
Browse files Browse the repository at this point in the history
  • Loading branch information
raynaudoe committed Sep 12, 2024
1 parent a5904ce commit b43c307
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 18 deletions.
Original file line number Diff line number Diff line change
@@ -1,12 +1,42 @@
name: Build Deterministic Runtimes
name: Create Runtimes releases

on:
release:
types: [published]
workflow_dispatch:
inputs:
tag_version:
description: 'Tag version for the release'
required: true
type: string

jobs:
generate-chain-specs:
uses: ./.github/workflows/generate-chain-specs.yaml

create-tag:
needs: generate-chain-specs
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0 # Fetch all history for all branches and tags

- name: Setup Git
run: |
git config --global user.name 'github-actions[bot]'
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
git remote set-url origin https://x-access-token:${GITHUB_TOKEN}@github.com/${{ github.repository }}
env:
GITHUB_TOKEN: ${{ secrets.PASEO_RUNTIME_CI_PAT }}

- name: Create and push tag
run: |
git checkout ${{ github.ref }}
git tag ${{ github.event.inputs.tag_version }}
git push origin ${{ github.event.inputs.tag_version }}
srtool:
needs: create-tag
runs-on: ubuntu-latest
permissions:
contents: write
Expand All @@ -21,9 +51,14 @@ jobs:
path: "system-parachains/bridge-hub-paseo"
- name: "people-paseo"
path: "system-parachains/people-paseo"
- name: "coretime-paseo"
path: "system-parachains/coretime-paseo"

steps:
- name: Checkout sources
uses: actions/checkout@v4
with:
ref: ${{ github.event.inputs.tag_version }}

- name: Cache runtime target dir
uses: actions/cache@v3
Expand All @@ -49,24 +84,27 @@ jobs:
run: |
echo '${{ steps.srtool_build.outputs.json }}' | jq . > ${{ matrix.runtime.name }}-srtool-digest.json
# Manual trigger: add artifacts to run
# Copy artifacts
- name: Copy artifacts
if: github.event_name != 'release'
run: cp `dirname ${{ steps.srtool_build.outputs.wasm }}`/*.wasm ./

- name: Archive Runtime
if: github.event_name != 'release'
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.runtime.name }}-runtime-${{ github.sha }}
name: ${{ matrix.runtime.name }}-runtime-${{ github.event.inputs.tag_version }}
path: |
${{ matrix.runtime.name }}*.wasm
${{ matrix.runtime.name }}-srtool-digest.json
# Release published: add artifacts to release
- name: Add artifacts to release
if: github.event_name == 'release'
- name: Create GitHub Release
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ github.event.inputs.tag_version }}
name: Release ${{ github.event.inputs.tag_version }}
draft: false
prerelease: false
generate_release_notes: true
append_body: true
body: |
## Runtime: `${{ matrix.runtime.name }}`
Expand All @@ -82,3 +120,5 @@ jobs:
files: |
${{ steps.srtool_build.outputs.wasm_compressed }}
${{ matrix.runtime.name }}-srtool-digest.json
env:
GITHUB_TOKEN: ${{ secrets.PASEO_RUNTIME_CI_PAT }}
11 changes: 2 additions & 9 deletions .github/workflows/generate-chain-specs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,6 @@ name: Generate Chain Specs

on:
workflow_dispatch:
push:
paths:
- 'chain-spec-generator/**'
- 'relay/**'
- 'system-parachains/**'
- 'Cargo.toml'
- 'Cargo.lock'

permissions:
contents: write
Expand All @@ -32,13 +25,13 @@ jobs:
- name: Setup Rust
uses: actions-rs/toolchain@v1
with:
toolchain: 1.79.0
toolchain: 1.77.0
target: wasm32-unknown-unknown
components: rust-src
override: true

- name: Add rust-src
run: rustup component add rust-src --toolchain 1.79.0-x86_64-unknown-linux-gnu
run: rustup component add rust-src --toolchain 1.77.0-x86_64-unknown-linux-gnu

- name: Build chain-spec-generator
run: cargo build --package chain-spec-generator --features=fast-runtime --release
Expand Down

0 comments on commit b43c307

Please sign in to comment.