Skip to content
This repository was archived by the owner on Aug 11, 2024. It is now read-only.

Commit a0418fe

Browse files
committed
👷 update release CI
1 parent ea3274e commit a0418fe

File tree

2 files changed

+52
-0
lines changed

2 files changed

+52
-0
lines changed
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
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

.github/workflows/release.yaml

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

0 commit comments

Comments
 (0)