v0.1.10 #7
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Release | |
on: | |
push: | |
tags: [ 'v*' ] | |
jobs: | |
deploy-package: | |
runs-on: ubuntu-latest | |
env: | |
DOCKER_IMAGE: build | |
PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }} | |
steps: | |
- name: Check out the repo | |
uses: actions/checkout@v2 | |
- name: Check the package version is the same as the tag | |
run: | | |
version=$(python3 setup.py --version) | |
if [ "${{ github.ref }}" != "refs/tags/v${version}" ]; then | |
echo "version in setup.py (v${version}) is different to the given tag (${{ github.ref }})" | |
exit 1; | |
fi | |
- name: Build docker image | |
run: docker build --tag $DOCKER_IMAGE . | |
- name: Create .pypirc file | |
run: echo -e "[pypi]\nusername=__token__\npassword=$PYPI_TOKEN" > .pypirc | |
- name: Publish package to pypi | |
run: docker run -v $(pwd)/.pypirc:/root/.pypirc $DOCKER_IMAGE /bin/bash -c "python setup.py bdist_wheel && twine upload --non-interactive --disable-progress-bar dist/*" | |
create-release: | |
needs: deploy-package | |
runs-on: ubuntu-latest | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
steps: | |
- name: Check out the repo | |
uses: actions/checkout@v2 | |
- name: Create Release | |
uses: actions/create-release@v1 | |
with: | |
tag_name: ${{ github.ref }} | |
release_name: Release ${{ github.ref }} | |
draft: false | |
prerelease: false |