Skip to content

Commit 0e924f2

Browse files
committed
adjusted publish & stale actions [ci skip]
Signed-off-by: Alexander Piskun <bigcat88@icloud.com>
1 parent c8e9e24 commit 0e924f2

File tree

2 files changed

+85
-2
lines changed

2 files changed

+85
-2
lines changed

.github/workflows/publish.yml

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
name: Publish
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
7+
jobs:
8+
build_wheels:
9+
if: "contains(github.event.head_commit.message, '[publish]')"
10+
name: Build Wheels
11+
runs-on: ubuntu-20.04
12+
13+
steps:
14+
- uses: actions/checkout@v3
15+
- name: Setup Python
16+
uses: actions/setup-python@v4
17+
with:
18+
python-version: '3.10'
19+
20+
- name: Preparations
21+
run: python3 -m pip install check-manifest twine build wheel
22+
23+
- name: Build
24+
run: |
25+
python3 -m check_manifest
26+
python3 -m build
27+
28+
- name: Check
29+
run: twine check dist/*
30+
31+
- name: Upload
32+
uses: actions/upload-artifact@v3
33+
with:
34+
name: wheels_nc_py_api
35+
path: dist/*.*
36+
if-no-files-found: error
37+
38+
publish_pypi:
39+
needs: [build_wheels]
40+
if: "contains(github.event.head_commit.message, '[publish]')"
41+
name: Upload to PyPi
42+
runs-on: ubuntu-20.04
43+
44+
steps:
45+
- uses: actions/checkout@v3
46+
- name: Get tag
47+
run: |
48+
RELEASE_VERSION=$(sed -n "s/^__version__.*\"\(.*\)\"$/\\1/p" ./nc_py_api/_version.py)
49+
echo RELEASE_TAG="v$RELEASE_VERSION" >> $GITHUB_ENV
50+
CHANGELOG=$(grep -oPz "(?s)##\s\[$RELEASE_VERSION.+?(?=##\s\[|$)" ./CHANGELOG.md | tr -d '\0' | sed /^$/d | sed '1d')
51+
CHANGELOG=$(echo "$CHANGELOG" | sed '$!N;s/^###.*\n#/#/;P;D' | sed '$!N;s/^###.*\n#/#/;P;D' | sed '${/^###/d;}')
52+
echo "CHANGELOG<<EOF" >> $GITHUB_ENV
53+
echo "$CHANGELOG" >> $GITHUB_ENV
54+
echo "EOF" >> $GITHUB_ENV
55+
56+
- name: Download sdist and wheels
57+
uses: actions/download-artifact@v3
58+
with:
59+
name: wheels_nc_py_api
60+
path: wheelhouse_nc_py_api
61+
62+
- name: Install twine
63+
run: |
64+
python3 -m pip install twine
65+
python3 -m pip install urllib3==1.26.15
66+
67+
- name: Publish NcPyApi
68+
run: |
69+
python3 -m twine upload --skip-existing wheelhouse_nc_py_api/*.whl
70+
python3 -m twine upload --skip-existing wheelhouse_nc_py_api/*tar.gz
71+
env:
72+
TWINE_USERNAME: __token__
73+
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
74+
75+
- name: Create release draft
76+
uses: ncipollo/release-action@v1.12.0
77+
with:
78+
name: ${{ env.RELEASE_TAG }}
79+
tag: ${{ env.RELEASE_TAG }}
80+
commit: ${{ github.ref }}
81+
draft: false
82+
body: ${{ env.CHANGELOG }}
83+
token: ${{ secrets.PAT_PH }}

.github/workflows/stale.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ jobs:
1010
steps:
1111
- uses: actions/stale@v8
1212
with:
13-
days-before-stale: 28
14-
days-before-close: 14
13+
days-before-stale: 14
14+
days-before-close: 9
1515
days-before-pr-close: -1 # Never close PR's automatically
1616
any-of-labels: 'question, invalid'
1717
stale-issue-message: 'This issue did not receive an update in the last 4 weeks.

0 commit comments

Comments
 (0)