Skip to content

Commit

Permalink
Create a release workflow
Browse files Browse the repository at this point in the history
This moves the release process from the test workflow to a release
workflow. This makes sure it only runs once, during the merge to main.
  • Loading branch information
benmezger committed Oct 9, 2023
1 parent ac40fb2 commit 3751849
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 7 deletions.
7 changes: 0 additions & 7 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,3 @@ jobs:
uses: codecov/codecov-action@v3
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

- name: Publish
env:
PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}
run: |
poetry config pypi-token.pypi $PYPI_TOKEN
poetry publish --build --skip-existing
46 changes: 46 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
on:
push:
branches: [main]

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

- uses: actions/setup-python@v2
with:
python-version: 3.11

- name: cache poetry install
uses: actions/cache@v2
with:
path: ~/.local
key: poetry-1.6.1

- uses: snok/install-poetry@v1
with:
version: 1.6.1
virtualenvs-create: true
virtualenvs-in-project: true

- name: cache deps
id: cache-deps
uses: actions/cache@v2
with:
path: .venv
key: pydeps-${{ hashFiles('**/poetry.lock') }}

- run: poetry install --no-interaction --no-root
if: steps.cache-deps.outputs.cache-hit != 'true'

- name: Install dependencies
run: poetry install --no-interaction

- name: Publish
env:
PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}
run: |
poetry config pypi-token.pypi $PYPI_TOKEN
poetry publish --build --skip-existing

0 comments on commit 3751849

Please sign in to comment.