|
| 1 | +# This workflow will upload a Python Package using Twine when a release is created |
| 2 | +# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python#publishing-to-package-registries |
1 | 3 |
|
2 | | -# Publish package on release branch if it's tagged with 'v*' |
3 | | -name: release & publish workflow |
| 4 | +# This workflow uses actions that are not certified by GitHub. |
| 5 | +# They are provided by a third-party and are governed by |
| 6 | +# separate terms of service, privacy policy, and support |
| 7 | +# documentation. |
| 8 | + |
| 9 | +name: Upload Python Package |
4 | 10 |
|
5 | | -# Controls when the action will run. |
6 | 11 | on: |
7 | | - # Triggers the workflow on push or pull request events but only for the default branch |
8 | | - push: |
9 | | - branch: main |
10 | | - tags: |
11 | | - - 'v*' |
| 12 | + release: |
| 13 | + types: [published] |
| 14 | + |
| 15 | +permissions: |
| 16 | + contents: read |
12 | 17 |
|
13 | | -# A workflow run is made up of one or more jobs that can run sequentially or in parallel |
14 | 18 | jobs: |
15 | | - update-release-draft: |
16 | | - runs-on: ubuntu-latest |
17 | | - steps: |
18 | | - # Drafts your next Release notes as Pull Requests are merged into "main" |
19 | | - - uses: release-drafter/release-drafter@v5 |
20 | | - env: |
21 | | - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 19 | + deploy: |
22 | 20 |
|
23 | | -# todo: Enable below to auto-publish these packages to PyPI on new push with tags |
24 | | -# # This workflow contains a single job called "build" |
25 | | -# release: |
26 | | -# name: Create Release |
27 | | -# runs-on: ubuntu-20.04 |
28 | | -# if: startsWith(github.event.ref, 'refs/tags/v') |
29 | | -# |
30 | | -# strategy: |
31 | | -# matrix: |
32 | | -# python-versions: [3.8] |
33 | | -# |
34 | | -# # Steps represent a sequence of tasks that will be executed as part of the job |
35 | | -# steps: |
36 | | -# # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it |
37 | | -# - uses: actions/checkout@v2 |
38 | | -# |
39 | | -# - name: generate change log |
40 | | -# uses: heinrichreimer/github-changelog-generator-action@v2.1.1 |
41 | | -# with: |
42 | | -# token: ${{ secrets.GITHUB_TOKEN }} |
43 | | -# issues: true |
44 | | -# issuesWoLabels: true |
45 | | -# pullRequests: true |
46 | | -# prWoLabels: true |
47 | | -# unreleased: true |
48 | | -# addSections: '{"documentation":{"prefix":"**Documentation:**","labels":["documentation"]}}' |
49 | | -# output: CHANGELOG.md |
50 | | -# |
51 | | -# - uses: actions/setup-python@v2 |
52 | | -# with: |
53 | | -# python-version: ${{ matrix.python-versions }} |
54 | | -# |
55 | | -# - name: Install dependencies |
56 | | -# run: | |
57 | | -# python -m pip install --upgrade pip |
58 | | -# pip install tox-gh-actions poetry |
59 | | -# |
60 | | -# - name: pre-publish documentation |
61 | | -# run: | |
62 | | -# poetry install -E doc |
63 | | -# poetry run mkdocs build |
64 | | -# |
65 | | -# - name: publish documentation |
66 | | -# uses: peaceiris/actions-gh-pages@v3 |
67 | | -# with: |
68 | | -# personal_token: ${{ secrets.PERSONAL_TOKEN }} |
69 | | -# publish_dir: ./site |
70 | | -# |
71 | | -# - name: Build wheels and source tarball |
72 | | -# run: >- |
73 | | -# poetry build |
74 | | -# |
75 | | -# - name: show temporary files |
76 | | -# run: >- |
77 | | -# ls -l |
78 | | -# |
79 | | -# - name: create github release |
80 | | -# id: create_release |
81 | | -# uses: softprops/action-gh-release@v1 |
82 | | -# env: |
83 | | -# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
84 | | -# with: |
85 | | -# body_path: ./CHANGELOG.md |
86 | | -# files: dist/*.whl |
87 | | -# draft: false |
88 | | -# prerelease: false |
89 | | -# |
90 | | -# - name: |
91 | | -# uses: pypa/gh-action-pypi-publish@release/v1 |
92 | | -# with: |
93 | | -# user: __token__ |
94 | | -# password: ${{ secrets.PYPI_API_TOKEN }} |
95 | | -# skip_existing: true |
| 21 | + runs-on: ubuntu-latest |
96 | 22 |
|
| 23 | + steps: |
| 24 | + - uses: actions/checkout@v3 |
| 25 | + - name: Set up Python |
| 26 | + uses: actions/setup-python@v3 |
| 27 | + with: |
| 28 | + python-version: '3.x' |
| 29 | + - name: Install dependencies |
| 30 | + run: | |
| 31 | + python -m pip install --upgrade pip |
| 32 | + pip install build |
| 33 | + - name: Build package |
| 34 | + run: python -m build |
| 35 | + - name: Publish package |
| 36 | + uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29 |
| 37 | + with: |
| 38 | + user: __token__ |
| 39 | + password: ${{ secrets.PYPI_API_TOKEN }} |
0 commit comments