Integrate with GitHub
Integrate IPM within GitHub
Integrate IPM with GitHub Workflows
This guide explains how to integrate IPM into your GitHub workflows. IPM can be installed dynamically within your workflows for tasks such as package management and status monitoring. Common use cases include downloading packages, publishing updates, and running status checks to enhance observability.
Installing IPM in Your Workflow
Add the following step to your workflow to install the latest version of IPM:
- name: Install IPM CLI
shell: bash
run: |
curl -Lo ipm-cli.tar.gz "https://github.com/ipmhubio/ipm/releases/download/0.7.0/ipm-linux-x64-full.tar.gz"
tar -xzf ipm-cli.tar.gz
sudo mv ./ipm /usr/local/bin/ipm
Authentication Setup
To use IPM in your workflows, you’ll need to authenticate using the --non-interactive
parameter and a client secret. You can provide authentication either through environment variables or command-line parameters. For more details about non-interactive mode, see the parameter documentation.
Setting Up Client Secrets
-
Create a client secret in the IPM portal following the client secrets creation guide
-
Add the secret to your GitHub repository:
- Navigate to your repository settings
- Select
Settings
→Secrets and Variables
→Actions
- Create a new secret
Click the image to enlarge
Authentication Methods
You can authenticate IPM using either environment variables or command-line parameters.
Using Environment Variables
Map the GitHub secret to the IPM_CLIENT_SECRETS
environment variable in your workflow:
- name: Run IPM Commands
env:
IPM_CLIENT_SECRETS: ${{ secrets.IPM_SECRET }}
run: |
ipm status --non-interactive
Using Command-line Parameters
Alternatively, pass the secret directly using the --client-secrets
parameter:
- name: Run IPM Commands
run: |
ipm status --non-interactive --client-secrets ${{ secrets.IPM_SECRET }}
Example Workflow Commands
Status Check
- name: Run IPM Status
env:
IPM_CLIENT_SECRETS: ${{ secrets.IPM_SECRET }}
shell: bash
run: |
cd $GITHUB_WORKSPACE
pwd
ls -lah
ipm status --non-interactive
Workspace Sync
- name: Run IPM Sync
env:
IPM_CLIENT_SECRETS: ${{ secrets.IPM_SECRET }}
shell: bash
run: |
cd $GITHUB_WORKSPACE
pwd
ls -lah
ipm sync --non-interactive
Complete Workflow Example
Here’s a complete workflow example that installs IPM and runs a status check:
name: Setup IPM CLI
on:
push:
branches:
- main
workflow_dispatch: # This allows the workflow to be triggered manually
jobs:
setup-ipm:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install IPM CLI
shell: bash
run: |
curl -Lo ipm-cli.tar.gz "https://github.com/ipmhubio/ipm/releases/download/0.7.0/ipm-linux-x64-full.tar.gz"
tar -xzf ipm-cli.tar.gz
sudo mv ./ipm /usr/local/bin/ipm
- name: Run IPM Status
shell: bash
run: |
cd $GITHUB_WORKSPACE
pwd
ls -lah
ipm status --non-interactive --client-secrets ${{ secrets.IPM_SECRET }}