-
Notifications
You must be signed in to change notification settings - Fork 0
90 lines (75 loc) · 2.25 KB
/
release.yml
File metadata and controls
90 lines (75 loc) · 2.25 KB
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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
name: Release
on:
release:
types: [published]
workflow_dispatch:
inputs:
version:
description: 'Version to release (e.g., 0.1.0)'
required: true
type: string
jobs:
build-and-publish:
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python 3.13.7
uses: actions/setup-python@v5
with:
python-version: "3.13.7"
- name: Cache pip dependencies
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/pyproject.toml') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install build twine
- name: Build package
run: |
python -m build
- name: Check package
run: |
twine check dist/*
- name: Upload to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: ${{ secrets.PYPI_USERNAME }}
password: ${{ secrets.PYPI_PASSWORD }}
- name: Create GitHub Release
if: github.event_name == 'release'
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.event.release.tag_name }}
release_name: ${{ github.event.release.name }}
body: ${{ github.event.release.body }}
draft: false
prerelease: false
test-release:
runs-on: ubuntu-latest
needs: build-and-publish
if: github.event_name == 'workflow_dispatch'
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python 3.13.7
uses: actions/setup-python@v5
with:
python-version: "3.13.7"
- name: Install released package
run: |
python -m pip install --upgrade pip
pip install sqlmodel-encrypted-fields==${{ github.event.inputs.version }}
- name: Test installed package
run: |
python -c "import sqlmodel_encrypted_fields; print('Package installed successfully')"
python -c "from sqlmodel_encrypted_fields import EncryptedString; print('Fields imported successfully')"