GitHub Actions
How to integrate GitHub Actions with Cloudsmith
The Cloudsmith GitHub Action allows you to use the Cloudsmith CLI to upload/push packages to Cloudsmith repositories. It currently supports pushing:
Adding your API Key to GitHub
Retrieve your Cloudsmith API Key.
You will need to add a secret to your GitHub repository named CLOUDSMITH_API_KEY
, with the value of your API-Key. Secrets are added through your GitHub repository settings, please see the Creating and Storing Encrypted Secrets documentation on GitHub for further details.
Pass your CLOUDSMITH_API_KEY
secret to the Action as per the examples.
OIDC Authentication
When using OIDC with GitHub Actions, save the JWT token to an environment variable called
CLOUDSMITH_API_KEY
and do not includeapi-key
in the.yaml
push action, the API key will be taken from the environment variable instead.
Examples
Push Alpine Package
name: Cloudsmith Push Alpine Package
on: push
jobs:
push:
runs-on: ubuntu-latest
name: Alpine Push
steps:
- uses: actions/checkout@v1
- name: Push
id: push
uses: cloudsmith-io/action@master
with:
api-key: ${{ secrets.CLOUDSMITH_API_KEY }}
command: "push"
owner: 'OWNER' # Your Cloudsmith account name or org name (namespace)
repo: 'REPOSITORY' # Your Cloudsmith Repository name (slug)
distro: "DISTRIBUTION" # Your Distribution (i.e alpine/v3.9)
republish: "true" # needed if version is not changing
file: "YOUR-FILENAME.apk" # Alpine package filename
Push Dart Package
name: Push Dart
on: push
jobs:
push:
runs-on: ubuntu-latest
name: Dart Push Demo
steps:
- uses: actions/checkout@v1
- name: Push
id: push
uses: cloudsmith-io/action@master
with:
api-key: ${{ secrets.CLOUDSMITH_API_KEY }}
command: "push"
format: "dart"
owner: 'OWNER' # Your Cloudsmith account name or org name (namespace)
repo: 'REPOSITORY' # Your Cloudsmith Repository name (slug)
republish: "true" # needed ONLY if version is not changing
file: "YOUR-FILENAME.tar.gz" # Dart package filename
Push Debian Package
name: Cloudsmith Push Debian Package
on: push
jobs:
push:
runs-on: ubuntu-latest
name: Debian Push
steps:
- uses: actions/checkout@v1
- name: Push
id: push
uses: cloudsmith-io/action@master
with:
api-key: ${{ secrets.CLOUDSMITH_API_KEY }}
command: 'push'
format: 'deb'
owner: 'OWNER' # Your Cloudsmith account name or org name (namespace)
repo: 'REPOSITORY' # Your Cloudsmith Repository name (slug)
distro: 'DISTRIBUTION' # Your Distribution (i.e Debian, Ubuntu)
release: 'RELEASE' # Your Distribution Release (i.e xenial, buster)
republish: 'true' # needed ONLY if version is not changing
file: 'YOUR-FILENAME.deb' # debian package filename
Push Docker Image
name: Cloudsmith Push Docker Image
on: push
jobs:
push:
runs-on: ubuntu-latest
name: Docker Push
steps:
- uses: actions/checkout@v1
- name: Push
id: push
uses: cloudsmith-io/action@master
with:
api-key: ${{ secrets.CLOUDSMITH_API_KEY }}
command: 'push'
format: 'docker'
owner: 'OWNER' # Your Cloudsmith account name or org name (namespace)
repo: 'REPOSITORY' # Your Cloudsmith Repository name (slug)
republish: 'true' # needed ONLY if version is not changing
file: 'IMAGE-FILE.tar.gz' # docker image filename
Push Go Package
name: Cloudsmith Push GO
on: push
jobs:
push:
runs-on: ubuntu-latest
name: GO Push
steps:
- uses: actions/checkout@v2
- name: Push
id: push
uses: cloudsmith-io/action@master
with:
api-key: ${{ secrets.CLOUDSMITH_API_KEY }}
command: 'push'
format: 'go'
owner: 'OWNER' # Your Cloudsmith account name or org name (namespace)
repo: 'REPOSITORY' # Your Cloudsmith Repository name (slug)
republish: 'true' # needed ONLY if version is not changing
file: 'YOUR-FILENAME.zip' # GO filename
Push Helm Chart
name: Cloudsmith Push Helm
on: push
jobs:
push:
runs-on: ubuntu-latest
name: Helm Push
steps:
- uses: actions/checkout@v2
- name: Push
id: push
uses: cloudsmith-io/action@master
with:
api-key: ${{ secrets.CLOUDSMITH_API_KEY }}
command: 'push'
format: 'helm'
owner: 'OWNER' # Your Cloudsmith account name or org name (namespace)
repo: 'REPOSITORY' # Your Cloudsmith Repository name (slug)
republish: 'true' # needed ONLY if version is not changing
file: 'YOUR-FILENAME.tar.gz' # helm chart filename
Push Maven Package
name: Cloudsmith Push Maven
on: push
jobs:
push:
runs-on: ubuntu-latest
name: Maven Push
steps:
- uses: actions/checkout@v2
- name: Push
id: push
uses: cloudsmith-io/action@master
with:
api-key: ${{ secrets.CLOUDSMITH_API_KEY }}
command: 'push'
format: 'maven'
owner: 'OWNER' # Your Cloudsmith account name or org name (namespace)
repo: 'REPOSITORY' # Your Cloudsmith Repository name (slug)
pom-file: 'YOUR-FILE.pom' # relevant `.pom` file for the package
republish: 'true' # needed ONLY if version is not changing
file: 'YOUR-FILENAME.jar' # maven filename
Push NPM Package
name: Cloudsmith Push NPM
on: push
jobs:
push:
runs-on: ubuntu-latest
name: NPM Push
steps:
- uses: actions/checkout@v2
- name: Push
id: push
uses: cloudsmith-io/action@master
with:
api-key: ${{ secrets.CLOUDSMITH_API_KEY }}
command: 'push'
format: 'npm'
owner: 'OWNER' # Your Cloudsmith account name or org name (namespace)
repo: 'REPOSITORY' # Your Cloudsmith Repository name (slug)
republish: 'true' # needed ONLY if version is not changing
file: 'YOUR-FILENAME.tgz' # npm filename
Push Python Package
name: Cloudsmith Push Python
on: push
jobs:
push:
runs-on: ubuntu-latest
name: Python Push
steps:
- uses: actions/checkout@v1
- name: Push
id: push
uses: cloudsmith-io/action@master
with:
api-key: ${{ secrets.CLOUDSMITH_API_KEY }}
command: "push"
format: "python"
owner: 'OWNER' # Your Cloudsmith account name or org name (namespace)
repo: 'REPOSITORY' # Your Cloudsmith Repository name (slug)
republish: 'true' # needed ONLY if version is not changing
file: "YOUR-FILENAME.tar.gz" # Python package filename
Push RPM package
name: Cloudsmith Push RedHat/RPM
on: push
jobs:
push:
runs-on: ubuntu-latest
name: RedHat/RPM Push Demo
steps:
- uses: actions/checkout@v1
- name: Push
id: push
uses: cloudsmith-io/action@master
with:
api-key: ${{ secrets.CLOUDSMITH_API_KEY }}
command: "push"
format: "rpm"
owner: 'OWNER' # Your Cloudsmith account name or org name (namespace)
repo: 'REPOSITORY' # Your Cloudsmith Repository name (slug)
distro: 'DISTRIBUTION' # Your Distribution (i.e el, fedora)
release: 'RELEASE' # Your Distribution Release (i.e 7, 32)
republish: 'true' # needed ONLY if version is not changing
file: "YOUR-FILENAME.rpm" #rpm package filename
Push Raw File
name: Cloudsmith Push Raw File
on: push
jobs:
push:
runs-on: ubuntu-latest
name: Raw Push
steps:
- uses: actions/checkout@v1
- name: Push
id: push
uses: cloudsmith-io/action@master
with:
api-key: ${{ secrets.CLOUDSMITH_API_KEY }}
command: 'push'
format: 'raw'
owner: 'OWNER' # Your Cloudsmith account name or org name (namespace)
repo: 'REPOSITORY' # Your Cloudsmith Repository name (slug)
file: 'FILENAME.txt' # Name of file
name: 'NAME' # Name for Raw package
summary: 'SUMMARY' # Optional Summary for Raw Package
description: 'DESCRIPTION' # Optional description for Raw package
version: ${{ github.sha }}
Updated about 1 month ago