Sign inSign up

lpenz/ghaction-packagecloud

By lpenz

•Updated 7 months ago

Github docker action that deploys debian packages to packagecloud.io

Image
0

10K+

lpenz/ghaction-packagecloud repository overview

marketplace CI github docker

⁠ghaction-packagecloud

ghaction-packagecloud is a simple github docker action that deploys debian packages to packagecloud.io⁠.

⁠Usage

The action runs the following:

package_cloud push <user>/<repository> <files>
  • user is the packagecloud.io user; it doesn't have to be specified is the user is equal to the github user.
  • repository is the only required parameter; it will usually include the OS and version, example: reponame/ubuntu/precise. That's better documented in https://packagecloud.io/docs#push_pkg⁠
  • files has the files to upload. Also optional - if not defined, the action uses all .deb files under the current directory.

Besides these parameters, the package_cloud script also needs the API Token to update the repository. You can get that from https://packagecloud.io/api_token⁠ after logging in. To pass it to the github action, configure it as a secret in github - you can do that by going to the repository's page, then going to Settings, Secrets - and then pass it using the PACKAGECLOUD_TOKEN environment variable.

Example workflow file:

on:
  push:
    tags: *
jobs:
  deploy:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - uses: docker://lpenz/ghaction-packagecloud:v0.2
        with:
          repository: lpenz/debian/stretch
        env:
          PACKAGECLOUD_TOKEN: ${{ secrets.PACKAGECLOUD_TOKEN }}

⁠Inputs

⁠user

packagecloud.io username. Optional, the default is the github user.

⁠repository

packagecloud.io repository. Required.

⁠directory

Enter this directory before pushing. Optional.

Mostly useful when the debian package is created in a subdirectory of the git repository.

⁠files

.deb files to push.

If not specified, use all .deb files under the current directory. If none are found, search in all subdirectories.

⁠Using in other environments

This github action is actually a docker image that can be used locally or even in travis-ci⁠. To do that, first download the image from docker hub⁠:

docker pull lpenz/ghaction-packagecloud:v0.2

Then, run a container in the project's directory, for instance:

docker run --rm -t -u "$UID" -w "$PWD" -v "${PWD}:${PWD}" \
  -e INPUT_REPOSITORY=lpenz/debian/stretch \
  -e PACKAGECLOUD_TOKEN \
  lpenz/ghaction-packagecloud:v0.2

It's worth pointing out that action parameters are passed as upper case environment variables, prefixed with INPUT_.

The following .travis.yml runs the same thing in travis-ci:

---
language: generic
jobs:
  include:
    - install: docker pull lpenz/ghaction-packagecloud:v0.2
    - script: -<
        docker run --rm -t -u "$UID" -w "$PWD" -v "${PWD}:${PWD}"
          -e INPUT_REPOSITORY=raspbian/debian/stretch
          -e PACKAGECLOUD_TOKEN
          lpenz/ghaction-packagecloud:v0.2

Tag summary

Content type

Image

Digest

Size

91.6 MB

Last updated

over 5 years ago

docker pull lpenz/ghaction-packagecloud