-
Notifications
You must be signed in to change notification settings - Fork 173
120 lines (93 loc) · 3.48 KB
/
releaser.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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
name: releaser
on:
push:
branches: [ master ]
env:
NEWV: ''
OLDV: ''
jobs:
run_tests:
uses: ./.github/workflows/test_runner.yml
make_new_release:
needs: run_tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: get new_version
id: new_version
uses: KJ002/[email protected]
with:
file: .github/config_new_release.yml
key-path: '["new_version"]'
- name: get_new_current_version
run: |
echo "NEWV=${{ steps.new_version.outputs.data }}" >> $GITHUB_ENV
echo "OLDV=$(grep "VERSION" -m1 pyproject.toml | cut -d"=" -f2 | sed "s/['\" ]//g")" >> $GITHUB_ENV
- name: verify ${{env.NEWV}} > ${{env.OLDV}}
if: ${{ env.NEWV <= env.OLDV }}
run: echo you did not increment the version number && exit 1
- name: get changes
id: changes
uses: KJ002/[email protected]
with:
file: .github/config_new_release.yml
key-path: '["change_log"]'
- name: get body
id: body
uses: KJ002/[email protected]
with:
file: .github/config_new_release.yml
key-path: '["release_body"]'
- name: update change log
run: |
sed 5q docs/change_log.rst > docs/new_log.rst
echo "$NEWV ($(date +%m/%d/%Y))" >> docs/new_log.rst
echo '~~~~~~~~~~~~~~' >> docs/new_log.rst
echo "${{ steps.changes.outputs.data }}" >> docs/new_log.rst
sed -n 6,$(wc -l docs/change_log.rst | cut -d' ' -f1)p docs/change_log.rst >> docs/new_log.rst
mv docs/new_log.rst docs/change_log.rst
- name: set up new version
run: |
sed -i "s/$OLDV/$NEWV/" pyproject.toml
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.10"
- name: install dependencies
run: |
python -m pip install --upgrade pip
pip install build twine jupyter pytest
- name: build package
run: python -m build
- uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_TOKEN }}
- name: install from pypi
run: |
while [ "$NEWV" != $(pip index versions pandas_market_calendars | cut -d'(' -f2 | cut -d')' -f1 | sed 1q) ];\
do echo not found yet, sleeping 5s; sleep 5s; done
pip install pandas_market_calendars==$NEWV
- name: run tests
run: |
pip install .
mv pandas_market_calendars pandas_market_calendars_copy
python -c 'import pandas_market_calendars;print(pandas_market_calendars.__version__)'
pytest tests
- name: prepare usage.rst
run: |
sudo apt install pandoc
jupyter nbconvert --execute --ExecutePreprocessor.kernel_name='python3' --to rst --output-dir docs --output usage.rst examples/usage.ipynb
- uses: stefanzweifel/git-auto-commit-action@v4
with:
file_pattern: pyproject.toml docs/change_log.rst docs/usage.rst
commit_message: '[GH-Actions] v${{ env.NEWV }} -- updated configuration and documentation files.'
- name: Create Release
uses: softprops/action-gh-release@v1
with:
name: v${{ env.NEWV }}
tag_name: v${{ env.NEWV }}
body: |
Changes:
${{ steps.changes.outputs.data }}
${{ steps.body.outputs.data }}