Skip to content

Commit dae9db8

Browse files
committed
feat: adds action to publish to pypi on tag
1 parent 23d7ece commit dae9db8

File tree

1 file changed

+58
-0
lines changed

1 file changed

+58
-0
lines changed

.github/workflows/publish-package.yml

+58
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
name: publish-pypi
2+
run-name: Test, build and publish to pypi by @${{ github.actor }}
3+
on:
4+
push:
5+
tags:
6+
- "v*.*.*" # Trigger the workflow only on version tags
7+
jobs:
8+
# test:
9+
# runs-on: ubuntu-latest
10+
11+
# steps:
12+
# - name: Checkout
13+
# uses: actions/checkout@v4
14+
# - name: Setup Python
15+
# uses: actions/setup-python@v5
16+
# with:
17+
# python-version-file: pyproject.toml
18+
# - name: Install Task
19+
# uses: arduino/setup-task@v2
20+
# with:
21+
# version: 3.x
22+
# repo-token: ${{ secrets.GITHUB_TOKEN }}
23+
# - name: Install dependencies
24+
# run: |
25+
# pip install poetry
26+
# poetry install
27+
# - name: Run tests
28+
# run: |
29+
# export GACC_API_KEY=${{ secrets.GACC_API_KEY }}
30+
# task test
31+
build-and-publish:
32+
runs-on: ubuntu-latest
33+
# needs: test
34+
35+
steps:
36+
- name: Checkout
37+
uses: actions/checkout@v4
38+
- name: Setup Python
39+
uses: actions/setup-python@v5
40+
with:
41+
python-version-file: pyproject.toml
42+
- name: Install Task
43+
uses: arduino/setup-task@v2
44+
with:
45+
version: 3.x
46+
repo-token: ${{ secrets.GITHUB_TOKEN }}
47+
- name: Install dependencies
48+
run: |
49+
pip install poetry
50+
poetry install
51+
- name: Build package
52+
run: |
53+
poetry build
54+
- name: Publish package
55+
env:
56+
POETRY_PYPI_TOKEN_PYPI: ${{ secrets.PYPI_API_KEY }}
57+
run: |
58+
poetry publish --no-interaction --username __token__ --password $POETRY_PYPI_TOKEN_PYPI

0 commit comments

Comments
 (0)