Skip to content

Generate new release, build and publish to PyPI #26

Generate new release, build and publish to PyPI

Generate new release, build and publish to PyPI #26

Workflow file for this run

# This is a basic workflow to help you get started with Actions
name: Generate new release, build and publish to PyPI
# Controls when the action will run.
on:
push:
tags:
- 'v*'
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
build:
# The type of runner that the job will run on
runs-on: ubuntu-latest
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2
- name: Set variables
id: set_vars
run: |
if [[ "${{github.base_ref}}" == "master" || "${{github.ref}}" == "refs/heads/master" ]]; then
echo "::set-output name=prerelease::false"
fi
if [[ "${{github.base_ref}}" != "master" || "${{github.ref}}" == "refs/heads/master" ]]; then
echo "::set-output name=prerelease::true"
fi
- name: Release
uses: docker://antonyurchenko/git-release:v4
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
DRAFT_RELEASE: "false"
PRE_RELEASE: "false"
CHANGELOG_FILE: "CHANGELOG.md"
ALLOW_EMPTY_CHANGELOG: "false"
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: 3.8
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install twine wheel
- name: Build binary wheel and a source tarball
run: |
python setup.py sdist bdist_wheel
- name: Publish distribution to Test PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.PYPI_TEST_API_TOKEN }}
repository-url: https://test.pypi.org/legacy/
- name: Publish distribution to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.PYPI_API_TOKEN }}
# - name: Tweet
# uses: m1ner79/Github-Twittction@master
# with:
# twitter_status: "Version ${{github.event.release.tag_name}} of ${{github.event.repository.full_name}} has been
# released. Take a look here ${{github.event.release.html_url}}."
# twitter_consumer_key: ${{ secrets.TWITTER_API_KEY }}
# twitter_consumer_secret: ${{ secrets.TWITTER_API_SECRET_KEY }}
# twitter_access_token_key: ${{ secrets.TWITTER_ACCESS_TOKEN }}
# twitter_access_token_secret: ${{ secrets.TWITTER_ACCESS_TOKEN_SECRET }}