File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11name : Cloudsmith Push
2- on :
3- push :
4- branches :
5- - master
6- tags :
7- - ' *'
2+ on : push
83jobs :
9- push-file :
4+ push :
105 runs-on : ubuntu-latest
116 name : Push demo
127 steps :
138 - name : Push
149 id : push
15- uses : AutoModality/action-cloudsmith@master
10+ uses : AutoModality/action-cloudsmith@BB-762
1611 with :
12+ api-key : ${{ secrets.CLOUDSMITH_API_KEY }}
1713 command : ' push'
1814 format : ' deb'
1915 owner : ' automodality'
2016 repo : ' trial'
2117 distro : ' ubuntu'
2218 release : ' xenial'
23- file : ' action.yml '
19+ file : ' /bin/bash ' # real file, but wrong format
2420
Original file line number Diff line number Diff line change 11# Container image that runs your code
2- FROM ubuntu:xenial
2+ FROM python:3.8-slim
33
44# Copies your code file from your action repository to the filesystem path `/` of the container
55COPY entrypoint.sh /entrypoint.sh
Original file line number Diff line number Diff line change 22Interact with Cloudsmith repositories using the cloudmsith cli
33to push packages, etc.
44
5- ## Inputs
5+ ## Cloudsmith CLI
6+ This action uses the Cloudsmith CLI and intends to be as similar
7+ to its structure and terminology as possible.
68
7- ### ` who-to-greet `
9+ ** Implemented**
10+ * Push
11+ * Debian format
812
9- ** Required** The name of the person to greet. Default ` "World" ` .
13+ ** Not Implemented**
14+ * Everything else
1015
11- ## Outputs
16+ ## Cloudsmith API Key
1217
13- ### ` time `
14-
15- The time we greeted you.
16-
17- ### ` os `
18-
19- The operating system that ran the action.
18+ The API key is required for the cloudsmith-cli to work.
19+ Add a secret in the settings of your repository named ` CLOUDSMITH_API_KEY ` .
2020
2121## Example usage
2222
23- uses: actions/hello-world-docker-action@v1
24- with:
25- who-to-greet: 'Mona the Octocat'
23+ ```
24+ name: Cloudsmith Push
25+ on: push
26+ jobs:
27+ push:
28+ runs-on: ubuntu-latest
29+ name: Push demo
30+ steps:
31+ - name: Push
32+ id: push
33+ uses: AutoModality/action-cloudsmith@BB-762
34+ with:
35+ command: 'push'
36+ format: 'deb'
37+ owner: 'automodality'
38+ repo: 'trial'
39+ distro: 'ubuntu'
40+ release: 'xenial'
41+ file: 'cool-lib_1.0.1_amd64.deb'
42+ ```
Original file line number Diff line number Diff line change 22name : ' Cloudsmith'
33description : ' Interact with Cloudsmith repositories'
44inputs :
5+ api-key :
6+ description : ' The Cloudsmith API Key in the Github Secrets repository settings.'
7+ required : true
58 command :
69 description : ' The desired action with cloudsmith (push, list, etc)'
710 required : true
2932 using : ' docker'
3033 image : ' Dockerfile'
3134 args : # these map in order with entrypoint.sh
35+ - ${{ inputs.api-key }}
3236 - ${{ inputs.command }}
3337 - ${{ inputs.format }}
3438 - ${{ inputs.owner }}
Original file line number Diff line number Diff line change 1- #! /bin/sh
1+ #! /bin/bash
22
33set -e # exit on error
44
5- command=$1
6- format=$2
7- org=$3
8- repo=$4
9- file=$5
10- distro=$6
11- release=$7
12-
13- apt-get -y update
14- apt-get -y install python-pip
15- pip install --upgrade pip
16- pip install cloudsmith-cli
5+ api_key=$1
6+ command=$2
7+ format=$3
8+ org=$4
9+ repo=$5
10+ file=$6
11+ distro=$7
12+ release=$8
13+
14+
1715# requires a CLOUDSMITH_API_KEY env variable to push
18- cloudsmith push $action $format $org /$repo /distro/release some-file.deb
16+ if [[ -z $api_key ]]; then
17+ echo " CLOUDSMITH_API_KEY is required"
18+ exit 1
19+ fi
20+
21+ export CLOUDSMITH_API_KEY=$api_key
22+
23+ if [[ " $command " != " push" ]]; then
24+ echo " command $comand not yet implemented."
25+ exit 3
26+ fi
27+
28+ pip install cloudsmith-cli
29+
30+
31+ if [[ " $format " == " deb" ]]; then
32+ cloudsmith push $action $format $org /$repo /$distro /$release $file
33+ else
34+ echo " format $format not yet implemented."
35+ exit 2
36+ fi
You can’t perform that action at this time.
0 commit comments