Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 5 additions & 9 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,24 +1,20 @@
name: Cloudsmith Push
on:
push:
branches:
- master
tags:
- '*'
on: push
jobs:
push-file:
push:
runs-on: ubuntu-latest
name: Push demo
steps:
- name: Push
id: push
uses: AutoModality/action-cloudsmith@master
uses: AutoModality/action-cloudsmith@BB-762
with:
api-key: ${{ secrets.CLOUDSMITH_API_KEY }}
command: 'push'
format: 'deb'
owner: 'automodality'
repo: 'trial'
distro: 'ubuntu'
release: 'xenial'
file: 'action.yml'
file: '/bin/bash' #real file, but wrong format

2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Container image that runs your code
FROM ubuntu:xenial
FROM python:3.8-slim

# Copies your code file from your action repository to the filesystem path `/` of the container
COPY entrypoint.sh /entrypoint.sh
Expand Down
45 changes: 31 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,41 @@
Interact with Cloudsmith repositories using the cloudmsith cli
to push packages, etc.

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

### `who-to-greet`
**Implemented**
* Push
* Debian format

**Required** The name of the person to greet. Default `"World"`.
**Not Implemented**
* Everything else

## Outputs
## Cloudsmith API Key

### `time`

The time we greeted you.

### `os`

The operating system that ran the action.
The API key is required for the cloudsmith-cli to work.
Add a secret in the settings of your repository named `CLOUDSMITH_API_KEY`.

## Example usage

uses: actions/hello-world-docker-action@v1
with:
who-to-greet: 'Mona the Octocat'
```
name: Cloudsmith Push
on: push
jobs:
push:
runs-on: ubuntu-latest
name: Push demo
steps:
- name: Push
id: push
uses: AutoModality/action-cloudsmith@BB-762
with:
command: 'push'
format: 'deb'
owner: 'automodality'
repo: 'trial'
distro: 'ubuntu'
release: 'xenial'
file: 'cool-lib_1.0.1_amd64.deb'
```
4 changes: 4 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
name: 'Cloudsmith'
description: 'Interact with Cloudsmith repositories'
inputs:
api-key:
description: 'The Cloudsmith API Key in the Github Secrets repository settings.'
required: true
command:
description: 'The desired action with cloudsmith (push, list, etc)'
required: true
Expand Down Expand Up @@ -29,6 +32,7 @@ runs:
using: 'docker'
image: 'Dockerfile'
args: # these map in order with entrypoint.sh
- ${{ inputs.api-key }}
- ${{ inputs.command }}
- ${{ inputs.format }}
- ${{ inputs.owner }}
Expand Down
46 changes: 32 additions & 14 deletions entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,18 +1,36 @@
#!/bin/sh
#!/bin/bash

set -e #exit on error

command=$1
format=$2
org=$3
repo=$4
file=$5
distro=$6
release=$7

apt-get -y update
apt-get -y install python-pip
pip install --upgrade pip
pip install cloudsmith-cli
api_key=$1
command=$2
format=$3
org=$4
repo=$5
file=$6
distro=$7
release=$8


# requires a CLOUDSMITH_API_KEY env variable to push
cloudsmith push $action $format $org/$repo/distro/release some-file.deb
if [[ -z $api_key ]]; then
echo "CLOUDSMITH_API_KEY is required"
exit 1
fi

export CLOUDSMITH_API_KEY=$api_key

if [[ "$command" != "push" ]]; then
echo "command $comand not yet implemented."
exit 3
fi

pip install cloudsmith-cli


if [[ "$format" == "deb" ]]; then
cloudsmith push $action $format $org/$repo/$distro/$release $file
else
echo "format $format not yet implemented."
exit 2
fi