Skip to content

Commit

Permalink
ci: async deploy build
Browse files Browse the repository at this point in the history
  • Loading branch information
crnbarr93 committed Nov 12, 2024
1 parent cc904de commit 7f25c4b
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 2 deletions.
20 changes: 19 additions & 1 deletion .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,19 @@ jobs:
name: contracts
path: ./artifacts/
if-no-files-found: error
build_deploy_script:
if: contains('["crnbarr93", "SlayerAnsh", "joemonem", "DimitrijeDragasevic", "cowboy0015"]', github.actor)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Build Deploy Script
run: cargo build -p andromeda-deploy
- name: Upload Artifacts
uses: actions/upload-artifact@v3
with:
name: deploy
path: ./target/release/andromeda-deploy
if-no-files-found: error
deploy:
runs-on: ubuntu-latest
needs: build_contracts
Expand All @@ -60,5 +73,10 @@ jobs:
with:
name: contracts
path: "./artifacts"
- name: Download Deploy Script
uses: actions/download-artifact@v3
with:
name: deploy
path: "./andromeda-deploy"
- name: Deploy
run: cargo run -p andromeda-deploy
run: ./andromeda-deploy
11 changes: 10 additions & 1 deletion packages/deploy/src/adodb.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,15 +50,24 @@ pub fn deploy(
);
send_notification(&deployment_msg).unwrap();

let mut deployed_contracts: Vec<(String, String, u64)> = vec![];
for (name, version, upload) in all_contracts {
if !contracts_to_deploy.is_empty() && !contracts_to_deploy.contains(&name) {
continue;
}

println!("Deploying {} {}", name, version);
let code_id = upload(&daemon)?;
adodb.publish(name, code_id, version, None, None)?;
adodb.publish(name.clone(), code_id, version.clone(), None, None)?;
deployed_contracts.push((name, version, code_id));
}

let mut deployment_table = String::from("🚀 *Deployed Contracts*\n```\n| Name | Version | Code ID |\n|------|---------|---------|\n");
for (name, code_id, version) in &deployed_contracts {
deployment_table.push_str(&format!("| {} | {} | {} |\n", name, version, code_id));
}
deployment_table.push_str("```");
send_notification(&deployment_table).unwrap();

Ok(())
}

0 comments on commit 7f25c4b

Please sign in to comment.