MultiConnectSDK › CLI
10. Deploy from CI
- Run
multiconnect initon your machine, and commitmulticonnect.json. It holds no key. - Add your key and secret to your CI system's secret store, as
MC_ACCESS_KEYandMC_ACCESS_SECRET. - Add a deploy step to your pipeline. If
multiconnect.jsonhas a build command, add--approve-build-command: in CI there is nobody to ask, so the CLI refuses to run a build command without it.
The CLI uses those two variables when they are set, and it never stops to ask a question in CI. A failed deploy fails the pipeline, because the exit code is not zero.
Use a key made for the pipeline, attached only to the deployments it deploys, so you can revoke it on its own.
Script 10.1: .github/workflows/deploy.yml, for GitHub Actions
name: Deploy
on:
push:
branches: [main]
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-dotnet@v4
with:
dotnet-version: '8.0.x'
- run: dotnet tool install --global MultiConnect.CLI
- run: multiconnect deploy --approve-build-command --tag ${{ github.sha }}
env:
MC_ACCESS_KEY: ${{ secrets.MC_ACCESS_KEY }}
MC_ACCESS_SECRET: ${{ secrets.MC_ACCESS_SECRET }}

