Skip to content

Commit

Permalink
ci: improve workflows and replace release workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
abn committed May 25, 2021
1 parent b749aa2 commit b39fef2
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 19 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/code-quality.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@ jobs:
pre-commit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v2
- uses: actions/setup-python@v1
- uses: pre-commit/action@v2.0.0
12 changes: 6 additions & 6 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,16 @@ on:

jobs:
tests:
name: ${{ matrix.os }} / ${{ matrix.python-version }}
runs-on: ${{ matrix.os }}-latest
continue-on-error: ${{ matrix.experimental }}
strategy:
matrix:
os: [Ubuntu]
python-version: [3.6, 3.7, 3.8, 3.9]
experimental: [false]
fail-fast: false

steps:
- uses: actions/checkout@v2
- uses: actions/setup-go@v2
Expand All @@ -31,12 +36,7 @@ jobs:

- name: Install poetry
shell: bash
run: |
pip install poetry
- name: Upgrade pip
shell: bash
run: poetry run pip install --upgrade pip
run: python -m pip install poetry

- name: Configure poetry
shell: bash
Expand Down
47 changes: 35 additions & 12 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,44 @@ on:
jobs:
release:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Set up Python 3.8
- name: Checkout code
uses: actions/checkout@v2

- name: Get tag
id: tag
run: echo ::set-output name=tag::${GITHUB_REF#refs/tags/}

- name: Set up Python 3.9
uses: actions/setup-python@v2
with:
python-version: 3.8
python-version: "3.9"

- name: Install dependencies
run: python -m pip install poetry

- name: Update PATH
run: echo "$HOME/.local/bin" >> $GITHUB_PATH

- name: Build project for distribution
run: poetry build

- name: Check Version
id: check-version
run: |
python -m pip install --upgrade pip
python -m pip install poetry
- name: Configure pypi credentials
[[ "$(poetry version --short)" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]] \
|| echo ::set-output name=prerelease::true
- name: Create Release
uses: ncipollo/release-action@v1
with:
artifacts: "dist/*"
token: ${{ secrets.GITHUB_TOKEN }}
draft: false
prerelease: steps.check-version.outputs.prerelease == 'true'

- name: Publish to PyPI
env:
PYPI_API_TOKEN: ${{ secrets.PYPI_API_TOKEN }}
run: |
poetry config http-basic.pypi __token__ "$PYPI_API_TOKEN"
- name: Publish release to pypi
run: |
poetry publish --build
POETRY_PYPI_TOKEN_PYPI: ${{ secrets.PYPI_API_TOKEN }}
run: poetry publish

0 comments on commit b39fef2

Please sign in to comment.