Skip to content

Commit f891e26

Browse files
authored
Automate releases (#17)
1 parent d05b0e1 commit f891e26

1 file changed

Lines changed: 33 additions & 3 deletions

File tree

.github/workflows/release.yml

Lines changed: 33 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,46 @@
11
name: Release
22

33
on:
4+
release:
5+
types:
6+
- "published"
47
push:
58
branches:
69
- main
7-
tags:
8-
- "v*"
910
pull_request:
1011
branches:
1112
- 'main'
1213

1314
jobs:
15+
pypi:
16+
runs-on: ubuntu-latest
17+
18+
steps:
19+
- uses: actions/checkout@v2
20+
21+
- name: Set up Python 3.7
22+
uses: actions/setup-python@v2
23+
with:
24+
python-version: 3.7
25+
26+
- name: Install and configure Poetry
27+
uses: snok/install-poetry@v1
28+
with:
29+
virtualenvs-in-project: true
30+
31+
- name: Install dependencies
32+
run: poetry install --no-interaction --no-ansi
33+
34+
- name: Build package
35+
run: poetry build
36+
37+
- name: Publish package
38+
if: github.event_name == 'release'
39+
env:
40+
PYPI_USERNAME: __token__
41+
PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}
42+
run: poetry publish --build -u "${PYPI_USERNAME}" -p "${PYPI_TOKEN}"
43+
1444
docker:
1545
runs-on: ubuntu-latest
1646
steps:
@@ -42,7 +72,7 @@ jobs:
4272
uses: docker/build-push-action@v4
4373
with:
4474
context: .
45-
push: ${{ github.event_name != 'pull_request' }}
75+
push: ${{ github.event_name == 'release' }}
4676
provenance: false
4777
platforms: linux/amd64,linux/arm64
4878
tags: ${{ steps.meta.outputs.tags }}

0 commit comments

Comments
 (0)