Skip to content

Commit

Permalink
Fix release workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
dolfinus committed Jan 20, 2021
1 parent 63a7bfe commit 77580e0
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 27 deletions.
59 changes: 37 additions & 22 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,24 +7,32 @@ on:

jobs:

prod:
name: Release version
wait:
name: Wait for tests
runs-on: ubuntu-latest

steps:
- name: Wait for tests
uses: fountainhead/[email protected]
- uses: fountainhead/[email protected]
id: wait-for-tests
with:
token: ${{ secrets.GITHUB_TOKEN }}
checkName: Run tests
checkName: Tests done
ref: ${{ github.ref }}
timeoutSeconds: 3600

- name: Fail the Build
uses: cutenode/action-always-fail@v1
if: steps.wait-for-tests.outputs.conclusion != 'success'

build:
name: Build package
runs-on: ubuntu-latest
needs: [wait]
strategy:
matrix:
python-version: ['2.7', '3.6']

steps:
- name: Checkout code
uses: actions/checkout@v2

Expand All @@ -33,6 +41,8 @@ jobs:

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

- name: Cache pip
uses: actions/cache@v2
Expand All @@ -48,15 +58,28 @@ jobs:
- name: Upgrade pip
run: python -m pip install --upgrade pip setuptools wheel twine

- name: Download artifacts
uses: dawidd6/action-download-artifact@v2
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
workflow: test.yml
workflow_conclusion: success
name: dist
path: ./dist/
- name: Install dependencies
run: pip install -r requirements.txt

- name: Build package
run: python setup.py bdist_wheel sdist

- name: Check package
run: twine check dist/*

- name: Publish package
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: |
twine upload --skip-existing dist/*
release:
name: Release version
runs-on: ubuntu-latest
needs: [wait, build]

steps:
- name: Create release
id: create_release
uses: actions/create-release@v1
Expand All @@ -66,12 +89,4 @@ jobs:
tag_name: ${{ github.ref }}
release_name: ${{ github.ref }}
draft: false
prerelease: false

- name: Build and publish
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
TWINE_REPOSITORY_URL: dolfinus/setuptools-git-versioning
run: |
twine upload dist/*
prerelease: false
13 changes: 8 additions & 5 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,11 @@ jobs:
- name: Build package
run: python setup.py bdist_wheel sdist

- name: Push build artifacts
uses: actions/upload-artifact@v2
with:
name: dist
path: dist/*
all_done:
name: Tests done
runs-on: ubuntu-latest
needs: [tests]

steps:
- name: All done
run: echo 1

0 comments on commit 77580e0

Please sign in to comment.