Skip to content

Commit

Permalink
Add GitHub action
Browse files Browse the repository at this point in the history
  • Loading branch information
wichert committed Jul 7, 2020
1 parent 0b4f856 commit f9328d4
Showing 1 changed file with 70 additions and 0 deletions.
70 changes: 70 additions & 0 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
on: [push, pull_request]

jobs:
test:
runs-on: ubuntu-latest

strategy:
matrix:
python: ["2.7", "3.6", "3.7", "3.8"]

name: Test Python ${{ matrix.python }}

steps:
- uses: actions/checkout@v2

- name: Set up Python ${{ matrix.python }}
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python }}

- name: Install dependencies
run: |
python -m pip install pytest -e .
- name: Run tests
run: py.test -v translationstring

release:
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags')
runs-on: ubuntu-latest
name: Release
needs: [ test ]

steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Set up Python
uses: actions/setup-python@v1
with:
python-version: 3.7

- name: Install wheel
run: python -m pip install wheel --user

- name: Insert version number
run: |
version=$(echo $GITHUB_REF | cut -d/ -f3)
sed -ie "/^version/s/=.*/= $version/" setup.cfg
- name: Build a binary wheel and a source tarball
run: python setup.py sdist bdist_wheel

- name: Publish package
uses: pypa/gh-action-pypi-publish@master
with:
user: __token__
password: ${{ secrets.pypi_password }}

- name: Create GitHub Release
id: create_release
uses: actions/create-release@latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
draft: false
prerelease: false

0 comments on commit f9328d4

Please sign in to comment.