Skip to content

Commit

Permalink
Add build job and publish workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
FichteFoll committed Apr 9, 2020
1 parent 1f596db commit c7eedb1
Show file tree
Hide file tree
Showing 2 changed files with 80 additions and 0 deletions.
40 changes: 40 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,3 +68,43 @@ jobs:
run: |
pip install coveralls
coveralls
build:
needs: [tests, flake8]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- name: Setup Python
uses: actions/setup-python@v1
with:
python-version: 3.x

- name: Install poetry
uses: dschep/install-poetry-action@v1.3
with:
version: ${{ env.POETRY_VERSION }}

- name: Build
run: poetry build

# I would prefer to do this as a separate conditional job,
# but uploading and downloading artifacts with dynamic file names is a pain.
- name: Set release metadata
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/v')
id: meta
shell: bash
run: |
echo "::set-output date=$(TZ=CET date -Idate)"
- name: Draft release
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/v')
uses: softprops/action-gh-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
name: ${{ github.ref }} (${{ steps.meta.outputs.date }})
body: TODO
files: dist/*
draft: true
prerelease: false
40 changes: 40 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Publish

on:
release:
types: [published]

env:
POETRY_VERSION: 1.0.5

jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- name: Fetch release assets
env:
EVENT_PATH: ${{ github.event_path }}
shell: bash
run: |
mkdir dist/
cd dist
jq -r ".release.assets[].browser_download_url" "$EVENT_PATH" \
| wget -i -
[[ -e $(command ls -A) ]] # fail if directory empty
- name: Setup Python
uses: actions/setup-python@v1
with:
python-version: 3.x

- name: Install poetry
uses: dschep/install-poetry-action@v1.3
with:
version: ${{ env.POETRY_VERSION }}

- name: Publish on PyPI
run: poetry publish
env:
POETRY_PYPI_TOKEN_PYPI: ${{ secrets.PYPI_TOKEN }}

0 comments on commit c7eedb1

Please sign in to comment.