-
Notifications
You must be signed in to change notification settings - Fork 0
78 lines (71 loc) · 1.95 KB
/
python-publish.yml
File metadata and controls
78 lines (71 loc) · 1.95 KB
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
# This workflow will build and release a Python Package
# author: LiaoPan
name: Release Python Package
on:
push:
branches: [ "main" ]
permissions:
contents: read
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python 3.11
uses: actions/setup-python@v3
with:
python-version: "3.11"
- name: Install pypa/build
run: >-
python -m
pip install
build
--user
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install flake8 pytest
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Build a binary wheel and a source tarball
run: >-
python -m
build
--sdist
--wheel
--outdir dist/
.
- name: Get version number
id: get_version
run: |
version=$(grep "__version__" opmpy/_version.py | cut -d "'" -f 2)
echo "version=$version" >> $GITHUB_ENV
- name: Print Version Number
run: echo "The version number is ${{ env.version }}"
- name: Create GitHub Release
env:
GH_TOKEN: ${{ secrets.ACCESS_TOKEN }}
run: >-
gh release create
'v${{ env.version }}'
--repo '${{ github.repository }}'
--notes "[Github Actions Workflow]Change Logs:"
--draft
--title 'v${{ env.version }}'
- name: Upload GitHub Binary Release
env:
GH_TOKEN: ${{ secrets.ACCESS_TOKEN }}
run: >-
gh release upload 'v${{ env.version }}'
'dist/opmpy-${{ env.version }}-py3-none-any.whl'
--clobber
# - name: Create GitHub Release
# uses: ncipollo/release-action@v1
# with:
# token: ${{ secrets.ACCESS_TOKEN }}
# tag: ${{ github.ref_name }}
# name: v${{ env.version }}
# draft: false
# prerelease: false
# files: |
# dist/*.whl
# dist/*.tar.gz