/action

Github Action that uses the cloudsmith cli to interact with the Cloudsmith API (pushes, etc)

Primary LanguageShellMIT LicenseMIT

Cloudsmith Push Action

Push packages easily to your Cloudsmith repositories, using the Cloudsmith CLI.

Cloudsmith CLI

This action uses the Cloudsmith CLI and intends to be as similar to its structure and terminology as possible.

Supported:

Not Supported, But May Work:

  • Push:
    • Other package formats may work but official support has not yet been added to the Action.

Please feel free to contribute pull requests to add additional support!

Cloudsmith API Key

The API key is required for the cloudsmith-cli to work.

Obtain the API Key from Cloudsmith user settings. You should use a least-privilege account for Continuous Integration.

Add a secret named CLOUDSMITH_API_KEY and a value of the API Key obtained from cloudsmith. Secrets are maintained in the settings of each repository.

Pass your secret to the Action as seen in the Example usage.

Examples

The following examples use static files located within test/fixtures. When republishing existing packages the republish flag must be set to true, but is otherwise recommended to not use this since it overwrites (and causes longer publish times).

To pin to a specific release of this Github Action, replace use: cloudsmith-io/action@master with the version you require e.g. uses: cloudsmith-io/action@0.4.0.

You can also add "tags" to your upload process by specifying tags in your workflow, this is a comma separated string. (Some special characters like : are not allowed).

Alpine Package Push

name: Push Alpine
on: push
jobs:
  push:
    runs-on: ubuntu-latest
    name: Alpine Push Demo
    steps:
      - uses: actions/checkout@v2
      - name: Push
        id: push
        uses: cloudsmith-io/action@master
        with:
          api-key: ${{ secrets.CLOUDSMITH_API_KEY }}
          command: "push"
          format: "alpine"
          owner: "cloudsmith"
          repo: "actions"
          distro: "alpine"
          release: "v3.9"
          republish: "true" # needed ONLY if version is not changing
          file: "test/fixture/cloudsmith-alpine-example-1.0.0-r0.apk"
          tags: "tag1, tag2, tag3"

Cargo Crate Push

name: Push Cargo
on: push
jobs:
  push:
    runs-on: ubuntu-latest
    name: Cargo Push Demo
    steps:
      - uses: actions/checkout@v2
      - name: Push
        id: push
        uses: cloudsmith-io/action@master
        with:
          api-key: ${{ secrets.CLOUDSMITH_API_KEY }}
          command: "push"
          format: "cargo"
          owner: "cloudsmith"
          repo: "actions"
          republish: "true" # needed ONLY if version is not changing
          file: "test/fixture/cloudsmith-cargo-example-0.1.0.crate"
name: Push Composer
on: push
jobs:
  push:
    runs-on: ubuntu-latest
    name: Composer Push Demo
    steps:
      - uses: actions/checkout@v2
      - name: Push
        id: push
        uses: cloudsmith-io/action@master
        with:
          api-key: ${{ secrets.CLOUDSMITH_API_KEY }}
          command: "push"
          format: "composer"
          owner: "cloudsmith"
          repo: "actions"
          republish: "true" # needed ONLY if version is not changing
          file: "test/fixture/cloudsmith-composer-package-archive-0.1.0.zip"
          tags: "tag1, tag2, tag3"

Dart Package Push

name: Push Dart
on: push
jobs:
  push:
    runs-on: ubuntu-latest
    name: Dart Push Demo
    steps:
      - uses: actions/checkout@v2
      - name: Push
        id: push
        uses: cloudsmith-io/action@master
        with:
          api-key: ${{ secrets.CLOUDSMITH_API_KEY }}
          command: "push"
          format: "dart"
          owner: "cloudsmith"
          repo: "actions"
          republish: "true" # needed ONLY if version is not changing
          file: "test/fixture/cloudsmith-dart-example-1.0.0.tar.gz"

Debian Package Push

name: Push Debian
on: push
jobs:
  push:
    runs-on: ubuntu-latest
    name: Debian Push Demo
    steps:
      - uses: actions/checkout@v2
      - name: Push
        id: push
        uses: cloudsmith-io/action@master
        with:
          api-key: ${{ secrets.CLOUDSMITH_API_KEY }}
          command: "push"
          format: "deb"
          owner: "cloudsmith"
          repo: "actions"
          distro: "ubuntu"
          release: "xenial"
          republish: "true" # needed ONLY if version is not changing
          file: "test/fixture/cloudsmith-debian-example_1.0.0_amd64.deb"

Docker Image Push

Note: In most cases, it is better to use the native docker cli to push images to the Cloudsmith Repository. Search the Marketplace for many supporting implementations.

See push-docker.yml

name: Push Docker
on: push
jobs:
  push:
    runs-on: ubuntu-latest
    name: Docker Push Demo
    steps:
      - uses: actions/checkout@v2
      - name: Push
        id: push
        uses: cloudsmith-io/action@master
        with:
          api-key: ${{ secrets.CLOUDSMITH_API_KEY }}
          command: "push"
          format: "docker"
          owner: "cloudsmith"
          repo: "actions"
          republish: "true" # needed ONLY if version is not changing
          file: "test/fixture/alpine-docker-test.tar.gz"

GO Push

name: Push GO
on: push
jobs:
  push:
    runs-on: ubuntu-latest
    name: Go Push Demo
    steps:
      - uses: actions/checkout@v2
      - name: Push
        id: push
        uses: ./
        with:
          api-key: ${{ secrets.CLOUDSMITH_API_KEY }}
          command: "push"
          format: "go"
          owner: "cloudsmith"
          repo: "actions"
          republish: "true" # needed ONLY if version is not changing
          file: "test/fixture/cloudsmith-go-example.zip" #real file that will repeat versions

Helm Chart Push

name: Push Helm
on: push
jobs:
  push:
    runs-on: ubuntu-latest
    name: Helm Push Demo
    steps:
      - uses: actions/checkout@v2
      - name: Push
        id: push
        uses: ./
        with:
          api-key: ${{ secrets.CLOUDSMITH_API_KEY }}
          command: "push"
          format: "helm"
          owner: "cloudsmith"
          repo: "actions"
          republish: "true" # needed ONLY if version is not changing
          file: "test/fixture/cloudsmith-chart-example-1.0.0.tar.gz" #real file that will repeat versions

Hex Push

name: Push Hex
on: push
jobs:
  push:
    runs-on: ubuntu-latest
    name: Hex Push Demo
    steps:
      - uses: actions/checkout@v2
      - name: Push
        id: push
        uses: ./
        with:
          api-key: ${{ secrets.CLOUDSMITH_API_KEY }}
          command: "push"
          format: "hex"
          owner: "cloudsmith"
          repo: "actions"
          republish: "true" # needed ONLY if version is not changing
          file: "test/fixture/cloudsmith-hex-example-1.0.0.tar" #real file that will repeat versions

Maven Package Push

name: Push Maven
on: push
jobs:
  push:
    runs-on: ubuntu-latest
    name: Maven Push Demo
    steps:
      - uses: actions/checkout@v2
      - name: Push
        id: push
        uses: ./
        with:
          api-key: ${{ secrets.CLOUDSMITH_API_KEY }}
          command: "push"
          format: "maven"
          owner: "cloudsmith"
          repo: "actions"
          pom-file: "test/fixture/cloudsmith-maven-example-1.0-SNAPSHOT.pom"
          republish: "true" # needed ONLY if version is not changing
          file: "test/fixture/cloudsmith-maven-example-1.0-SNAPSHOT.jar" #real file that will repeat versions

NPM Package Push

name: Push NPM
on: push
jobs:
  push:
    runs-on: ubuntu-latest
    name: NPM Push Demo
    steps:
      - uses: actions/checkout@v2
      - name: Push
        id: push
        uses: ./
        with:
          api-key: ${{ secrets.CLOUDSMITH_API_KEY }}
          command: "push"
          format: "npm"
          owner: "cloudsmith"
          repo: "actions"
          republish: "true" # needed ONLY if version is not changing
          file: "test/fixture/cloudsmith-npm-example-1.0.0.tgz" #real file that will repeat versions

Nuget Package Push

name: Push Nuget
on: push
jobs:
  push:
    runs-on: ubuntu-latest
    name: Nuget Push Demo
    steps:
      - uses: actions/checkout@v2
      - name: Push
        id: push
        uses: ./
        with:
          api-key: ${{ secrets.CLOUDSMITH_API_KEY }}
          command: "push"
          format: "nuget"
          owner: "cloudsmith"
          repo: "actions"
          republish: "true" # needed ONLY if version is not changing
          file: "test/fixture/cloudsmith-nuget-example.1.0.0.nupkg" #real file that will repeat versions
          symbols-file: "test/fixture/cloudsmith-nuget-example.1.0.0.snupkg"

Python Package Push

name: Push Python
on: push
jobs:
  push:
    runs-on: ubuntu-latest
    name: Python Push Demo
    steps:
      - uses: actions/checkout@v2
      - name: Push
        id: push
        uses: cloudsmith-io/action@master
        with:
          api-key: ${{ secrets.CLOUDSMITH_API_KEY }}
          command: "push"
          format: "python"
          owner: "cloudsmith"
          repo: "actions"
          republish: "true" # needed ONLY if version is not changing
          file: "test/fixture/cloudsmith-python-example-1.0.0.tar.gz"

RedHat/RPM Package Push

name: Push RedHat/RPM
on: push
jobs:
  push:
    runs-on: ubuntu-latest
    name: RedHat/RPM Push Demo
    steps:
      - uses: actions/checkout@v2
      - name: Push
        id: push
        uses: cloudsmith-io/action@master
        with:
          api-key: ${{ secrets.CLOUDSMITH_API_KEY }}
          command: "push"
          format: "rpm"
          owner: "cloudsmith"
          repo: "actions"
          distro: "any-distro"
          version: "any-version"
          republish: "true" # needed ONLY if version is not changing
          file: "test/fixture/cloudsmith-rpm-example-1.0-1.x86_64.rpm" #real file that will repeat versions

Raw File Push

name: Push Raw
on: push
jobs:
  push:
    runs-on: ubuntu-latest
    name: Raw File Push Demo
    steps:
      - uses: actions/checkout@v2
      - name: Push
        id: push
        uses: cloudsmith-io/action@master
        with:
          api-key: ${{ secrets.CLOUDSMITH_API_KEY }}
          command: "push"
          format: "raw"
          owner: "cloudsmith"
          repo: "actions"
          file: "test/fixture/raw_file.txt"
          name: "Raw Test"
          summary: "Github Action test of raw pushes"
          description: "See https://github.com/cloudsmith-io/action"
          version: ${{ github.sha}}

Thanks

A huge thank you to @aroller (Aaron) at @AutoModality for creating the original GitHub action for Cloudsmith.

Contributing

Yes! Please do contribute, this is why we love open source. Please see CONTRIBUTING.md for contribution guidelines when making code changes or raising issues for bug reports, ideas, discussions and/or questions (i.e. help required).

EOF

This quality product was brought to you by Cloudsmith and the fine folks who have contributed.