Skip to content

Commit 5919e36

Browse files
committed
add action
1 parent 11ccd61 commit 5919e36

2 files changed

Lines changed: 58 additions & 0 deletions

File tree

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: Setup Python
2+
description: Setup Python
3+
4+
inputs:
5+
python-version:
6+
description: Python version
7+
required: false
8+
default: "3.10"
9+
10+
runs:
11+
using: "composite"
12+
steps:
13+
- uses: pdm-project/setup-pdm@v3
14+
name: Setup PDM
15+
with:
16+
python-version: ${{ inputs.python-version }}
17+
architecture: "x64"
18+
cache: true
19+
20+
- run: pdm sync -G:all
21+
shell: bash

.github/workflows/release.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- v*
7+
8+
jobs:
9+
pypi-publish:
10+
name: upload release to PyPI
11+
runs-on: ubuntu-latest
12+
permissions:
13+
id-token: write
14+
contents: write
15+
steps:
16+
- uses: actions/checkout@v3
17+
18+
- name: Setup Python environment
19+
uses: ./.github/actions/setup-python
20+
21+
- name: Get Version
22+
id: version
23+
run: |
24+
echo "VERSION=$(pdm show --version)" >> $GITHUB_OUTPUT
25+
echo "TAG_VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT
26+
echo "TAG_NAME=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
27+
28+
- name: Check Version
29+
if: steps.version.outputs.VERSION != steps.version.outputs.TAG_VERSION
30+
run: exit 1
31+
32+
- name: Publish Package
33+
run: |
34+
pdm publish
35+
gh release upload --clobber ${{ steps.version.outputs.TAG_NAME }} dist/*.tar.gz dist/*.whl
36+
env:
37+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)