├── Dockerfile ├── README.md ├── action.yml ├── LICENSE └── entrypoint.sh /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM plugins/pypi:latest 2 | 3 | LABEL "com.github.actions.name"="Bump Version" 4 | LABEL "com.github.actions.description"="A GitHub Action to easily bump version files" 5 | LABEL "com.github.actions.icon"="chevrons-up" 6 | LABEL "com.github.actions.color"="red" 7 | 8 | 9 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Pypi 2 | Deploy package to pypi. 3 | 4 | 5 | ## Usage: 6 | ```yaml 7 | - name: Deploy package 8 | uses: remorses/pypi@master 9 | with: 10 | setupfile: ./setup.py 11 | username: ${{ secrets.pypi_username }} 12 | password: ${{ secrets.pypi_password }} 13 | 14 | ``` 15 | -------------------------------------------------------------------------------- /action.yml: -------------------------------------------------------------------------------- 1 | name: 'Deploy Pypi' 2 | description: 'A GitHub Action to deploy python packages to pypi' 3 | author: 'Tommaso De Rossi' 4 | branding: 5 | icon: 'upload-cloud' 6 | color: 'purple' 7 | inputs: 8 | setup_file: 9 | description: setup file 10 | default: ./setup.py 11 | username: 12 | description: username 13 | required: true 14 | password: 15 | description: password 16 | required: true 17 | # distributions: 18 | # - sdist 19 | # - bdist_wheel 20 | # PLUGIN_DISTRIBUTIONS: 21 | runs: 22 | using: 'docker' 23 | image: 'Dockerfile' 24 | env: 25 | PLUGIN_SETUPFILE: ${{ inputs.setup_file }} 26 | PLUGIN_USERNAME: ${{ inputs.username }} 27 | PLUGIN_PASSWORD: ${{ inputs.password }} 28 | 29 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | 2 | The MIT License (MIT) 3 | 4 | Copyright (c) 2018 GitHub, Inc. and contributors 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. 23 | -------------------------------------------------------------------------------- /entrypoint.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | set -e 4 | 5 | echo starting 6 | 7 | # only_on_commit 8 | # VERSION_FILE 9 | # github_token 10 | # prefix 11 | 12 | ([ -z "$GITHUB_ONLY_ON_COMMIT" ] || [ "$GITHUB_ONLY_ON_COMMIT" = "$GITHUB_COMMIT_MESSAGE" ]) || exit 0 13 | 14 | [ -z "$GITHUB_VERSION_FILE" ] && GITHUB_VERSION_FILE=./VERSION 15 | # [ \( -z "$REPOSITORY" \) -a \( ! -z "$CIRCLE_PROJECT_REPONAME" \) ] && REPOSITORY="$CIRCLE_PROJECT_USERNAME/$CIRCLE_PROJECT_REPONAME" 16 | # [ -f $GITHUB_VERSION_FILE ] || (echo "file containing current version is needed, default is ./VERSION, customizable with GITHUB_VERSION_FILE env var" && exit 1) 17 | # [ -z "$REPOSITORY" ] && (echo "env var REPOSITORY is needed when executing outside of circleci, (for exampe REPOSITORY=user/repo)" && exit 1) 18 | 19 | git config user.email "bump@version.com" 20 | git config user.name "bump-version" 21 | 22 | # git checkout master 23 | git pull --commit --no-edit https://${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git # master 24 | 25 | 26 | 27 | # [ -z "$GIT_CHECK" ] || /suitable $GIT_CHECK && CONTINUE=1 28 | # [ -n "$CONTINUE" ] || exit 0 29 | 30 | 31 | (/script/bump --filename $GITHUB_VERSION_FILE) 32 | export VERSION=`cat $GITHUB_VERSION_FILE` 33 | 34 | [ -n "$GITHUB_PREFIX" ] || (echo 'running _sed'; /_sed) 35 | [ -z "$GITHUB_PREFIX" ] || (echo 'running _sed_with_prefix'; /_sed_with_prefix) 36 | 37 | git add -A 38 | git commit -m "${GITHUB_PREFIX} ${VERSION}" -m "[skip ci]" 39 | [ -n "$GITHUB_PREFIX" ] && (git tag -a "${GITHUB_PREFIX}_${VERSION}" -m "[skip ci]") || (git tag -a "${VERSION}" -m "[skip ci]") 40 | git push --tags https://${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git HEAD 41 | --------------------------------------------------------------------------------