-
Notifications
You must be signed in to change notification settings - Fork 0
89 lines (85 loc) · 2.8 KB
/
publish.yaml
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
79
80
81
82
83
84
85
86
87
88
89
name: Bump version
on: push
# pull_request:
# types:
# - closed
jobs:
# test:
# # if: github.event.pull_request.merged == true
# name: ${{ matrix.name }}
# runs-on: ${{ matrix.os }}
# timeout-minutes: 10
# strategy:
# matrix:
# include:
# - name: 'check'
# python: '3.9'
# toxpython: 'python3.9'
# os: 'ubuntu-latest'
# - name: 'py39 (ubuntu)'
# python: '3.9'
# toxpython: 'python3.9'
# python_arch: 'x64'
# os: 'ubuntu-latest'
# - name: 'py39 (windows)'
# python: '3.9'
# toxpython: 'python3.9'
# python_arch: 'x64'
# os: 'windows-latest'
# - name: 'py39 (macos)'
# python: '3.9'
# toxpython: 'python3.9'
# python_arch: 'arm64'
# os: 'macos-latest'
# steps:
# - name: Checkout code
# uses: actions/checkout@v4
# with:
# ref: ${{ github.event.pull_request.merge_commit_sha }}
# fetch-depth: '0'
# - name: Set up Python ${{ matrix.python }}
# uses: actions/setup-python@v5
# with:
# python-version: ${{ matrix.python }}
# - name: Install Poetry
# run: pipx install poetry || pip install poetry
# - name: Install dependencies
# run: poetry install --with dev
# - name: Run tests
# run: poetry run pytest
bump_version_and_publish:
# needs: test
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.merge_commit_sha }}
fetch-depth: '0'
- name: Set up Python ${{ matrix.python }}
uses: actions/setup-python@v5
with:
python-version: '3.9'
- name: Install Poetry
run: pipx install poetry || pip install poetry
- name: Install dependencies
run: poetry install --with dev
- name: Bump version and push tag
if: success() # Only continue if all was successful till now
uses: anothrNick/github-tag-action@1.67.0
env:
GITHUB_TOKEN: ${{secrets.LIB_ML_PAT_CONTENT_ACCESS}}
DEFAULT_BUMP: patch
TAG_CONTEXT: branch
WITH_V: false
PRERELEASE: false
- name: Update files with new version
if: success() # Only continue if tagging was successful
run: poetry run bump-my-version replace --config-file pyproject.toml --new-version $(git describe --tags --abbrev=0)
- name: Build and publish to PyPI
if: success() # Only continue if version in files was updated
run: |
poetry config repositories.testpypi https://test.pypi.org/legacy/
poetry publish --build -r testpypi -u __token__ -p ${{ secrets.PYPI_TEST_ACCOUNT }}