Only commit on changes #7
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: Generate Chain Specs | |
on: | |
workflow_dispatch: | |
push: | |
permissions: | |
contents: write | |
jobs: | |
build-and-generate: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Install Dependencies | |
run: | | |
sudo apt update | |
sudo apt install -y git protobuf-compiler | |
- name: Setup Rust | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: 1.79.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 | |
- name: Build chain-spec-generator | |
run: cargo build --package chain-spec-generator --features=fast-runtime --release | |
- name: Generate chain specs | |
run: | | |
mkdir -p chain-specs/local | |
PACKAGES=( | |
"paseo-local" | |
"paseo-dev" | |
"asset-hub-paseo-local" | |
"bridge-hub-paseo-local" | |
"people-paseo-local" | |
"coretime-paseo-local" | |
"coretime-paseo-tot" | |
"coretime-paseo" | |
) | |
for pkg in "${PACKAGES[@]}"; do | |
./target/release/chain-spec-generator "$pkg" --raw > "chain-specs/local/$pkg.json" | |
echo "Generated chain-specs/local/$pkg.json" | |
done | |
- 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: Commit changes | |
run: | | |
git add chain-specs/local/*.json | |
if git diff --staged --quiet; then | |
echo "No changes detected in chain specs. Skipping commit." | |
else | |
git commit -m "Update chain specs" | |
git push | |
echo "Changes committed and pushed successfully." | |
fi |