-
Notifications
You must be signed in to change notification settings - Fork 59
72 lines (60 loc) · 2.11 KB
/
update_pypi.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
name: Python package release
on:
workflow_dispatch:
inputs:
version:
description: 'Version to release'
required: true
jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.10'
cache: "pip"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine
- name: Update __version__ in __init__.py
run: python .github/workflows/set_version.py ${{ github.event.inputs.version }}
- name: Configure Git
run: |
git config user.name "GitHub Actions"
git config user.email "actions@github.com"
- name: Commit and push if changed
run: |
git diff
git diff --quiet || (git add . && git commit -m 'update __version__')
git push https://${{secrets.GITHUB_TOKEN}}@github.com/tatsu-lab/alpaca_farm.git HEAD:main
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Push Tag
run: |
git pull --tags
git tag v${{ github.event.inputs.version }}
git push origin v${{ github.event.inputs.version }}
- name: Create Release
uses: softprops/action-gh-release@v1
with:
name: Release v${{ github.event.inputs.version }}
tag_name: v${{ github.event.inputs.version }}
draft: false
prerelease: false
repository: tatsu-lab/alpaca_farm
generate_release_notes: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Build and publish
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.TWINE_PASSWORD }}
run: |
python3 -m pip install --upgrade build
python3 -m build
python3 -m pip install --upgrade twine
python3 -m twine upload dist/*