generated from yanyongyu/python-poetry-template
-
-
Notifications
You must be signed in to change notification settings - Fork 2
86 lines (71 loc) · 2.17 KB
/
release.yml
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
name: Release
on:
push:
tags:
- v*
jobs:
check-version:
name: Check Version
runs-on: ubuntu-latest
permissions:
contents: read
outputs:
VERSION: ${{ steps.version.outputs.VERSION }}
TAG_VERSION: ${{ steps.version.outputs.TAG_VERSION }}
TAG_NAME: ${{ steps.version.outputs.TAG_NAME }}
steps:
- name: 🛎️ Checkout
uses: actions/checkout@v4
- name: 🚀 Setup Python environment
uses: ./.github/actions/setup-python
- name: 🔖 Get version
id: version
run: |
echo "VERSION=$(poetry version -s)" >> $GITHUB_OUTPUT
echo "TAG_VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT
echo "TAG_NAME=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
- name: ✅ Check version
if: steps.version.outputs.VERSION != steps.version.outputs.TAG_VERSION
run: exit 1
release:
name: Release
runs-on: ubuntu-latest
needs: check-version
permissions:
id-token: write
contents: write
steps:
- name: 🛎️ Checkout
uses: actions/checkout@v4
- name: 🚀 Setup pnpm
uses: pnpm/action-setup@v2
with:
version: 8
- name: 🚀 Setup node
uses: actions/[email protected]
with:
node-version: 18
cache: "pnpm"
cache-dependency-path: "pnpm-lock.yaml"
- name: 🔧 Install dependencies
run: pnpm install
- name: 🚧 Build dist files
run: pnpm build
- name: 📦️ Upload dist
uses: actions/upload-artifact@v3
with:
name: dist
path: nb_cli_plugin_webui/dist
- name: 🚀 Setup Python environment
uses: ./.github/actions/setup-python
- name: 🚧 Build package
run: |
poetry run compile
poetry build
- name: 📦️ Publish package to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
- name: 📦️ Publish package to GitHub
run: |
gh release upload --clobber ${{ needs.check-version.outputs.TAG_NAME }} dist/*.tar.gz dist/*.whl
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}