Hi everyone,
I’m encountering an issue where my GitHub Actions workflow fails when attempting to deploy backend canisters to the IC. I’m using a dfx
command in the workflow, and while it works locally, it consistently fails when running in the GitHub Actions environment.
Error: Failed to create canister 'provision'.
Caused by: No wallet configured for combination of identity 'actions' and network 'ic'
Error: Process completed with exit code 255.
Here’s the core part of my GitHub Actions workflow YAML:
jobs:
test:
name: Run Canister Test Suite
runs-on: ubuntu-22.04
steps:
- name: Checkout Code
uses: actions/checkout@v3
- name: Cache install Nix packages
uses: rikhuijzer/cache-install@v1.1.4
with:
key: nix-${{ hashFiles('default.nix') }}
# - name: Install Rust
# run: |
# sudo apt update
# curl https://sh.rustup.rs -sSf | sh -s -- -y
# source $HOME/.cargo/env
# cargo install ic-cdk-optimizer
- name: Cache rust dependencies, build output and DFX build cache
uses: actions/cache@v3
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
.dfx/
key: rust-test-${{ hashFiles('**/Cargo.lock') }}
- name: Import DFX Identity # Import DFX identity using secret key
run: |
touch actions_identity.pem
echo "${{ secrets.FUEL_DAO_CANISTER_CONTROLLER_PRIVATE_KEY }}" > actions_identity.pem
nix-shell --run "dfx identity import --disable-encryption actions actions_identity.pem"
rm actions_identity.pem
nix-shell --run "dfx identity use actions"
- name: Start Local Replica # Start local DFX replica
run: nix-shell --run "dfx start --background"
- name: Use myidentity # Start local DFX replica
run: nix-shell --run "dfx identity use actions"
- name: check balance
run: nix-shell --run "dfx cycles balance --network ic"
- name: Deploy Backend Canister to ICP # Deploy canister to the Internet Computer
env:
ICP_NETWORK: ic # Specify the network to deploy to (default is 'ic')
run: |
nix-shell --run "dfx deploy backend --network ic --yes"
- name: Deploy Provision Canister to ICP # Deploy canister to the Internet Computer
env:
ICP_NETWORK: ic # Specify the network to deploy to (default is 'ic')
run: |
nix-shell --run "dfx canister create provision --network ic"
nix-shell --run "dfx deploy provision --network ic --yes"
- name: Deploy Asset_proxy Canister to ICP # Deploy canister to the Internet Computer
env:
ICP_NETWORK: ic # Specify the network to deploy to (default is 'ic')
run: |
nix-shell --run "dfx canister create asset_proxy --network ic"
nix-shell --run "dfx deploy asset_proxy --network ic --yes"
- name: Deploy Asset Canister to ICP # Deploy canister to the Internet Computer
env:
ICP_NETWORK: ic # Specify the network to deploy to (default is 'ic')
run: |
nix-shell --run "dfx canister create asset --network ic"
nix-shell --run "dfx deploy asset --network ic --yes"
- name: Call Upload Asset Wasm Script
run: |
chmod +x ./scripts/upload_asset_wasm.sh
nix-shell --run "./scripts/upload_asset_wasm.sh"
- name: Call Upload Token Wasm Script
run: |
chmod +x ./scripts/upload_token_wasm.sh
nix-shell --run "./scripts/upload_token_wasm.sh"
- name: Stop Local Replica # Stop the local DFX replica
run: nix-shell --run "dfx stop"