Skip to content

Commit a32cc01

Browse files
author
GuangChen2333
committed
feat(action): Automatic
1 parent c09dca9 commit a32cc01

2 files changed

Lines changed: 91 additions & 4 deletions

File tree

.github/workflows/release.yml

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
name: Release
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
release-tag:
7+
description: 'Release Tag (0.x.x)'
8+
required: true
9+
10+
jobs:
11+
release-build:
12+
runs-on: ubuntu-latest
13+
14+
permissions:
15+
contents: write
16+
17+
steps:
18+
- name: Checkout
19+
uses: actions/[email protected]
20+
21+
- name: Setup Python
22+
uses: actions/[email protected]
23+
with:
24+
python-version: '3.12'
25+
26+
- name: Install Poetry Action
27+
uses: snok/[email protected]
28+
with:
29+
virtualenvs-create: false
30+
31+
- name: Install dependencies
32+
run: poetry install
33+
34+
- name: Update version
35+
run: poetry version ${{ inputs.release-tag }}
36+
37+
- name: Commit and push if changes
38+
run: |
39+
changes=$(git diff --name-only origin/master | wc -l)
40+
if [ $changes -gt 0 ]
41+
then
42+
git config user.name 'github-actions[bot]'
43+
git config user.email 'github-actions[bot]@users.noreply.github.com'
44+
git add pyproject.toml
45+
git commit -am "Bump version to ${{ inputs.release-tag }}"
46+
git tag "v${{ inputs.release-tag }}"
47+
git push --follow-tags
48+
fi
49+
50+
- name: Build release distributions
51+
run: poetry build
52+
53+
- name: Upload a Build Artifact
54+
uses: actions/[email protected]
55+
with:
56+
name: release-dists
57+
path: dist/
58+
59+
pypi-publish:
60+
runs-on: ubuntu-latest
61+
needs:
62+
- release-build
63+
permissions:
64+
id-token: write
65+
contents: write
66+
67+
steps:
68+
- name: Retrieve release distributions
69+
uses: actions/[email protected]
70+
with:
71+
name: release-dists
72+
path: dist/
73+
74+
- name: Release package
75+
uses: softprops/[email protected]
76+
with:
77+
generate_release_notes: true
78+
name: structovo v${{ inputs.release-tag }}
79+
tag_name: v${{ inputs.release-tag }}
80+
files: dist/*
81+
82+
- name: Publish release distributions to PyPI
83+
uses: pypa/[email protected]

pyproject.toml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,21 @@
1-
[tool.poetry]
1+
[project]
22
name = "structovo"
33
version = "0.1.0"
4-
description = ""
5-
authors = ["GuangChen2333 <[email protected]>"]
4+
description = "A Python library offering a more concise syntax for data packing."
5+
license = { text = "MIT" }
6+
authors = [
7+
{ name = "GuangChen23333", email = "[email protected]" }
8+
]
69
readme = "README.md"
10+
11+
[tool.poetry]
712
packages = [
813
{ include = "structovo", from = "src" }
914
]
1015

1116
[tool.poetry.dependencies]
1217
python = "^3.12"
1318

14-
1519
[build-system]
1620
requires = ["poetry-core"]
1721
build-backend = "poetry.core.masonry.api"

0 commit comments

Comments
 (0)