-
Notifications
You must be signed in to change notification settings - Fork 0
67 lines (67 loc) · 2.19 KB
/
poetry-build.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
---
name: poetry-build
on:
push:
branches: ['**/**']
jobs:
verify-with-tox:
runs-on: ubuntu-latest
steps:
- name: 📄 Checkout code
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4
with:
fetch-depth: 0
- name: 🧱 Install Poetry
run: curl -sSL https://install.python-poetry.org | python3 -
- name: 🧱 Setup Python
uses: actions/setup-python@f677139bbe7f9c59b41e40162b753c062f5d49a3 # v5
with:
python-version: '3.12'
cache: poetry
- name: 🧱 Install dependencies
run: poetry install
- name: Run tests
run: poetry run tox
release-please:
needs: verify-with-tox
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main'
permissions:
contents: write
pull-requests: write
steps:
- name: release-please
id: release
uses: googleapis/release-please-action@db8f2c60ee802b3748b512940dde88eabd7b7e01 # v3
with:
release-type: python
include-v-in-tag: false
outputs:
release_created: ${{ steps.release.outputs.releases_created }}
version: ${{ steps.release.outputs.version }}
build-and-publish:
needs: release-please
runs-on: ubuntu-latest
if: ${{ needs.release-please.outputs.release_created == 'true' }}
permissions:
contents: write # Required for uploading artifacts to GitHub release
steps:
- name: 📄 Checkout code
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4
with:
fetch-depth: 0
- name: 🧱 Install Poetry
run: curl -sSL https://install.python-poetry.org | python3 -
- name: 🧱 Setup Python
uses: actions/setup-python@f677139bbe7f9c59b41e40162b753c062f5d49a3 # v5
with:
python-version: '3.12'
cache: poetry
- name: 🧱 Install dependencies
run: poetry install
- name: 📦 Build the package
run: poetry build
- name: 📦 Publish artifacts to GitHub release
env:
GH_TOKEN: ${{ github.token }}
run: gh release upload "${{ needs.release-please.outputs.version }}" dist/*.{tar.gz,whl}