-
Notifications
You must be signed in to change notification settings - Fork 0
55 lines (46 loc) · 1.55 KB
/
Copy pathci_publish.yml
File metadata and controls
55 lines (46 loc) · 1.55 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
name: Build and Publish Python Package
on:
push:
branches:
- main
workflow_dispatch:
jobs:
build-and-publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.12"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install build twine
- name: Build package
run: python -m build
- name: Check distribution
run: twine check dist/*
- name: Publish to PyPI
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
env:
TWINE_USERNAME: ${{secrets.PYPI_USERNAME}}
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
run: twine upload dist/*
- name: Get version
id: get_version
run: |
VERSION=$(PYTHONPATH=src python -c "from substack import __version__; print(__version__)")
echo "VERSION=${VERSION}" >> $GITHUB_OUTPUT
- name: Create GitHub Release
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: v${{ steps.get_version.outputs.VERSION }}
release_name: "v${{ steps.get_version.outputs.VERSION }}"
body: "Release notes for version v${{ steps.get_version.outputs.VERSION }}"
draft: false
prerelease: false
generate_release_notes: true