Skip to content

Commit 98a5e7a

Browse files
committed
[ADD] build and publish workflows
1 parent 9c3a6b3 commit 98a5e7a

2 files changed

Lines changed: 76 additions & 0 deletions

File tree

.github/workflows/build.yml

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
name: Build
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*'
7+
8+
jobs:
9+
build:
10+
runs-on: ubuntu-latest
11+
timeout-minutes: 60
12+
strategy:
13+
matrix:
14+
python-version:
15+
- '3.10'
16+
17+
steps:
18+
- uses: actions/checkout@v3
19+
with:
20+
fetch-depth: 0
21+
22+
- name: Create Release
23+
id: create_release
24+
uses: actions/create-release@v1
25+
env:
26+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
27+
with:
28+
tag_name: ${{ github.ref }}
29+
release_name: Release ${{ github.ref }}
30+
draft: false
31+
prerelease: ${{ contains(github.ref, '-beta') || contains(github.ref, '-alpha') || contains(github.ref, '-rc') }}
32+
33+
- name: Extract tag name
34+
id: get_version
35+
run: echo "VERSION=${GITHUB_REF/refs/tags/}" >> $GITHUB_ENV
36+
37+
- name: Set up Python ${{ matrix.python-version }}
38+
uses: actions/setup-python@v4
39+
with:
40+
python-version: ${{ matrix.python-version }}
41+
42+
- name: Install dependencies
43+
run: |
44+
python -m pip install --upgrade pip setuptools wheel
45+
46+
- name: Build package
47+
run: |
48+
. ./build.sh
49+
50+
- name: Upload Release wheel
51+
id: upload-release-asset
52+
uses: actions/upload-release-asset@v1
53+
env:
54+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
55+
with:
56+
upload_url: ${{ steps.create_release.outputs.upload_url }}
57+
asset_path: ./dist.zip
58+
asset_name: dist.zip
59+
asset_content_type: application/zip

.github/workflows/publish.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
name: Publish to PyPI.org
2+
on:
3+
release:
4+
types: [published]
5+
jobs:
6+
pypi:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- name: Checkout
10+
uses: actions/checkout@v3
11+
with:
12+
fetch-depth: 0
13+
- run: python3 -m pip install --upgrade build && python3 -m build
14+
- name: Publish package
15+
uses: pypa/gh-action-pypi-publish@release/v1
16+
with:
17+
password: ${{ secrets.PYPI_API_TOKEN }}

0 commit comments

Comments
 (0)