-
Notifications
You must be signed in to change notification settings - Fork 14
60 lines (48 loc) · 1.65 KB
/
publish.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
name: Publish Python Package
on:
push:
branches:
- master
jobs:
build-and-publish:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.x' # specify your desired Python version
- name: Set up Git user
run: |
git config --global user.name "github-actions"
git config --global user.email "[email protected]"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine bump2version
- name: Bump version
run: bump2version patch # or 'minor' or 'major' depending on the level of version bump you want
- name: Get bumped version
id: get_version
run: |
echo "VERSION=$(python setup.py --version)" >> $GITHUB_ENV
- name: Create GitHub release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
VERSION: ${{ env.VERSION }}
run: |
curl -X POST \
-H "Authorization: token $GITHUB_TOKEN" \
-H "Accept: application/vnd.github.v3+json" \
https://api.github.com/repos/${{ github.repository }}/releases \
-d '{"tag_name":"v'${{ env.VERSION }}'","name":"v'${{ env.VERSION }}'","body":"Release version '${{ env.VERSION }}'"}'
- name: Build package
run: python setup.py sdist bdist_wheel
- name: Publish package
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.SEARCHADS_API_PUBLISH_TOKEN }}
run: twine upload dist/*
- name: Clean up
run: rm -rf dist build *.egg-info