Skip to content

Commit

Permalink
Merge pull request #34 from Tea-n-Tech/feature/poetry
Browse files Browse the repository at this point in the history
Adding poetry
  • Loading branch information
codie3611 authored Aug 22, 2021
2 parents 178950b + 4cb530a commit a06aa5c
Show file tree
Hide file tree
Showing 15 changed files with 1,992 additions and 713 deletions.
7 changes: 7 additions & 0 deletions .github/workflows/python-lint-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,13 @@ jobs:
run: |
sh -c "$(curl --location https://taskfile.dev/install.sh)" -- -d
- name: Load cached venv
id: cached-poetry-dependencies
uses: actions/cache@v2
with:
path: .venv
key: venv-${{ runner.os }}-${{ hashFiles('**/poetry.lock') }}

- name: Install Dependencies
run: |
python -m pip install --upgrade pip
Expand Down
31 changes: 27 additions & 4 deletions .github/workflows/python-upload.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:
push:
branches:
- staging
- "release/*"
- "main"
tags:
- "**"

Expand All @@ -13,10 +13,16 @@ defaults:
shell: bash

jobs:
release:
upload:
runs-on: ubuntu-latest

steps:
- name: Cancel previous runs on the same branch
if: ${{ github.ref != 'refs/heads/main' }}
uses: styfle/[email protected]
with:
access_token: ${{ github.token }}

- uses: actions/checkout@v2

- name: Set up Python
Expand Down Expand Up @@ -56,8 +62,24 @@ jobs:
path: dist
if-no-files-found: error

- name: Test for PyPi Test Secret
id: check_secrets
shell: bash
run: |
unset HAS_TEST_SECRET
if [ -n "$PYPI_TEST_TOKEN" ]; then HAS_TEST_SECRET='true' ; fi
echo ::set-output name=HAS_TEST_SECRET::${HAS_TEST_SECRET}
unset HAS_SECRET
if [ -n "$PYPI_TOKEN" ]; then HAS_SECRET='true' ; fi
echo ::set-output name=HAS_SECRET::${HAS_SECRET}
env:
PYPI_TEST_TOKEN: "${{ secrets.TEST_PYPI_API_TOKEN }}"
PYPI_TOKEN: "${{ secrets.PYPI_API_TOKEN }}"

- name: Publish package to Test-PyPi
if: github.event_name == 'push' && startsWith(github.ref, 'refs/staging')
# if: ${{ github.ref != 'refs/heads/staging' }}
if: steps.check_secrets.outputs.HAS_TEST_SECRET
env:
TWINE_REPOSITORY_URL: https://test.pypi.org/legacy/
TWINE_USERNAME: __token__
Expand All @@ -66,7 +88,8 @@ jobs:
run: twine upload --non-interactive --skip-existing --verbose 'dist/*'

- name: Publish package to PyPi
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
# if: ${{ github.ref != 'refs/heads/main' }}
if: steps.check_secrets.outputs.HAS_SECRET && startsWith(github.event.ref, 'refs/tags')
env:
TWINE_USERNAME: __token__
TWINE_NON_INTERACTIVE: 1
Expand Down
Loading

0 comments on commit a06aa5c

Please sign in to comment.