Skip to content

Commit e6ccb33

Browse files
committed
Adding publishing github action
1 parent 1f477de commit e6ccb33

File tree

1 file changed

+85
-0
lines changed

1 file changed

+85
-0
lines changed

.github/workflows/publish.yml

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
name: Publish package
2+
on: workflow_dispatch
3+
4+
jobs:
5+
publish:
6+
runs-on: ubuntu-latest
7+
permissions: write-all
8+
steps:
9+
- name: Checkout
10+
uses: actions/checkout@v3
11+
with:
12+
submodules: true
13+
14+
- name: Git configuration
15+
run: |
16+
git config --global user.email "<>"
17+
git config --global user.name "GitHub Actions"
18+
19+
- name: Setup python environment
20+
run: |
21+
pip3 install -r requirements.txt
22+
23+
- name: Set release version
24+
run: |
25+
echo "NEW_VERSION=$(tools/update-version.py release)" >> $GITHUB_ENV
26+
27+
- name: Build
28+
run: |
29+
rm -rf code/wrappers/python/src/spreader.egg-info
30+
mkdir -p dist/tmp
31+
python3 setup.py egg_info --egg-base dist/tmp sdist
32+
33+
- name: Update changelog
34+
uses: superfaceai/release-changelog-action@v2
35+
with:
36+
path-to-changelog: CHANGELOG.md
37+
version: ${{ env.NEW_VERSION }}
38+
operation: release
39+
40+
- name: Commit CHANGELOG.md and package.json changes and create tag
41+
run: |
42+
git add "setup.py"
43+
git add "CHANGELOG.md"
44+
git commit -m "chore: release ${{ env.NEW_VERSION }}"
45+
git tag ${{ env.NEW_VERSION }}
46+
47+
- name: Set next dev version
48+
run: |
49+
NEXT_VERSION=$(tools/update-version.py nextpatch)
50+
git add "setup.py"
51+
git commit -m "chore: bump version to $NEXT_VERSION"
52+
53+
- name: Push changes to repository
54+
env:
55+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
56+
run: |
57+
git push origin && git push --tags
58+
59+
- name: Publish
60+
run: twine upload --non-interactive dist/eg.spreader-${{ env.NEW_VERSION }}.tar.gz
61+
env:
62+
TWINE_REPOSITORY: testpypi
63+
TWINE_USERNAME: __token__
64+
TWINE_PASSWORD: ${{ secrets.TESTPYPI_ACCESS_TOKEN }}
65+
66+
- id: get-changelog
67+
name: Get version changelog
68+
uses: superfaceai/release-changelog-action@v2
69+
with:
70+
path-to-changelog: CHANGELOG.md
71+
version: ${{ env.NEW_VERSION }}
72+
operation: read
73+
74+
- name: Update GitHub release documentation
75+
uses: softprops/action-gh-release@v1
76+
with:
77+
tag_name: ${{ env.NEW_VERSION }}
78+
body: ${{ steps.get-changelog.outputs.changelog }}
79+
files: |
80+
dist/eg.spreader-${{ env.NEW_VERSION }}.tar.gz
81+
draft: true
82+
env:
83+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
84+
85+

0 commit comments

Comments
 (0)