Skip to content

Commit d8c28d3

Browse files
committed
feat: Add GitHub Actions workflows for Python package build and release
1 parent 59a7191 commit d8c28d3

2 files changed

Lines changed: 92 additions & 0 deletions

File tree

.github/workflows/python.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
---
2+
# NOTE: This file is auto generated by OpenAPI Generator.
3+
# URL: https://openapi-generator.tech
4+
#
5+
# ref: https://docs.github.com/en/actions/automating-builds-and-tests/
6+
# building-and-testing-python
7+
name: "payjpv2 Python package"
8+
9+
"on": workflow_dispatch
10+
11+
jobs:
12+
build:
13+
runs-on: ubuntu-latest
14+
strategy:
15+
matrix:
16+
python-version:
17+
- "3.8"
18+
- "3.9"
19+
- "3.10"
20+
- "3.11"
21+
- "3.12"
22+
- "3.13"
23+
24+
steps:
25+
- uses: actions/checkout@v4
26+
- name: Set up Python ${{ matrix.python-version }}
27+
uses: actions/setup-python@v4
28+
with:
29+
python-version: ${{ matrix.python-version }}
30+
- name: Install dependencies
31+
run: |
32+
python -m pip install --upgrade pip
33+
pip install -r requirements.txt
34+
pip install -r test-requirements.txt
35+
- name: Test with pytest
36+
run: |
37+
pytest --cov=payjpv2

.github/workflows/release.yml

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
name: Release Python Package
2+
3+
on:
4+
push:
5+
tags:
6+
- "v*"
7+
8+
jobs:
9+
release:
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- uses: actions/checkout@v4
14+
15+
- name: Set up Python
16+
uses: actions/setup-python@v4
17+
with:
18+
python-version: "3.8"
19+
20+
- name: Install dependencies
21+
run: |
22+
python -m pip install --upgrade pip
23+
pip install build twine
24+
pip install -r requirements.txt
25+
pip install -r test-requirements.txt
26+
27+
- name: Run tests
28+
run: |
29+
pytest --cov=payjpv2
30+
31+
- name: Build package
32+
run: |
33+
python -m build
34+
35+
- name: Publish to PyPI
36+
env:
37+
TWINE_USERNAME: __token__
38+
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
39+
run: |
40+
twine upload dist/*
41+
42+
- name: Create GitHub Release
43+
uses: actions/create-release@v1
44+
env:
45+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
46+
with:
47+
tag_name: ${{ github.ref }}
48+
release_name: Release ${{ github.ref }}
49+
body: |
50+
Changes in this Release
51+
- Updated package metadata
52+
- Improved security
53+
- See CHANGELOG.md for details
54+
draft: false
55+
prerelease: false

0 commit comments

Comments
 (0)