Skip to content

Github docker action that deploys debian packages to packagecloud.io

License

Notifications You must be signed in to change notification settings

lpenz/ghaction-packagecloud

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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:

jobs:
  deploy:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - <build debian package>
      - uses: docker://lpenz/ghaction-packagecloud:0.4
        with:
          repository: lpenz/debian/stretch
        env:
          PACKAGECLOUD_TOKEN: ${{ secrets.PACKAGECLOUD_TOKEN }}

For a more complete example, here are some github repositories that use this action: execpermfix, ogle, ftpsmartsync.

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:0.4

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:0.4

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:0.4
    - script: -<
        docker run --rm -t -u "$UID" -w "$PWD" -v "${PWD}:${PWD}"
          -e INPUT_REPOSITORY=raspbian/debian/stretch
          -e PACKAGECLOUD_TOKEN
          lpenz/ghaction-packagecloud:0.4