forked from morganstanley/testplan
-
Notifications
You must be signed in to change notification settings - Fork 0
95 lines (85 loc) · 3.09 KB
/
Copy pathcut_version.yml
File metadata and controls
95 lines (85 loc) · 3.09 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
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
90
91
92
93
94
95
name: Cut new version
on:
workflow_dispatch:
jobs:
check-new-version:
runs-on: ubuntu-latest
permissions: write-all
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
fetch-depth: 0
- uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
with:
python-version: '3.11'
- run: pip install -U pip
- run: pip install bumpver git+https://github.com/morganstanley/releaseherald.git
- run: |
bumpver show --env > new-version.txt
cat new-version.txt
- name: check tag manually created & matched
run: |
set -x
eval $(cat new-version.txt)
echo -e "Current tag:\n$(git tag --points-at HEAD)"
echo "Expected tag: ${CURRENT_VERSION}"
if [[ ! $(git tag --points-at HEAD) =~ "${CURRENT_VERSION}" ]]; then
echo "Tag not properly set, aborting..."
exit 1
fi
shell: bash
- run: releaseherald generate --latest --no-update -t news.rst
- uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
with:
name: new-version
path: |
new-version.txt
news.rst
build:
runs-on: ubuntu-latest
needs: check-new-version
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- run: git pull origin
- uses: ./.github/actions/build-package
- uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
with:
name: package
path: dist/
publish:
runs-on: ubuntu-latest
permissions: write-all
needs: [check-new-version, build]
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
sparse-checkout: |
.github
- uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: new-version
- uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: package
path: dist/
- name: Get Version
id: get_version
run: |
eval $(cat new-version.txt)
echo "new_version=${CURRENT_VERSION}" >> $GITHUB_OUTPUT
- uses: ./.github/actions/create-release
with:
tag_name: ${{ steps.get_version.outputs.new_version }}
package: dist/testplan-${{ steps.get_version.outputs.new_version }}-py3-none-any.whl
news: news.rst
- name: Publish to Test PyPI
if: ${{github.ref_name == 'test_pypi'}}
uses: pypa/gh-action-pypi-publish@ed0c53931b1dc9bd32cbe73a98c7f6766f8a527e # v1.13.0
with:
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
repository-url: https://test.pypi.org/legacy/
- name: Publish to PyPI
if: ${{github.ref_name != 'test_pypi'}}
uses: pypa/gh-action-pypi-publish@ed0c53931b1dc9bd32cbe73a98c7f6766f8a527e # v1.13.0
with:
password: ${{ secrets.PYPI_API_TOKEN }}