Skip to content

Commit 6e9bfe6

Browse files
authored
Merge pull request #2 from git-mastery/woojiahao/automate-publish
Automate publish
2 parents 05d36a8 + 843653b commit 6e9bfe6

File tree

2 files changed

+25
-28
lines changed

2 files changed

+25
-28
lines changed

.github/workflows/bump-version.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
name: Bump version tag on merge
2+
3+
on:
4+
pull_request:
5+
types: [closed]
6+
branches: [main]
7+
8+
jobs:
9+
tag:
10+
uses: git-mastery/actions/.github/workflows/bump-version.yml@main
11+
secrets: inherit

.github/workflows/publish.yml

Lines changed: 14 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
name: Build and release difflib-parser to PyPi
22

33
on:
4+
workflow_run:
5+
workflows:
6+
- Bump version tag on merge
7+
types:
8+
- completed
49
workflow_dispatch:
510
push:
611
tags:
@@ -13,32 +18,13 @@ permissions:
1318
issues: read
1419

1520
jobs:
16-
publish:
17-
runs-on: ubuntu-latest
18-
19-
steps:
20-
- name: Checkout repository
21-
uses: actions/checkout@v3
22-
23-
- name: Setup Python
24-
uses: actions/setup-python@v5
25-
with:
26-
python-version: "3.13"
27-
28-
- name: Install dependencies
29-
run: |
30-
python -m pip install --upgrade pip
31-
pip install -r requirements.txt
21+
prepare:
22+
uses: git-mastery/actions/.github/workflows/get-latest-tag.yml@main
3223

33-
- name: Run unit tests
34-
run: |
35-
python -m pytest -s -vv
36-
37-
- name: Build binary
38-
run: |
39-
echo "__version__ = \"${GITHUB_REF_NAME}\"" > src/difflib_parser/version.py
40-
python -m build
41-
42-
- name: Publish
43-
run: |
44-
python -m twine upload --username "__token__" --password ${{ secrets.PYPI_TOKEN }} --skip-existing --verbose dist/*
24+
publish:
25+
needs: prepare
26+
uses: git-mastery/actions/.github/workflows/publish-pypi-library.yml@main
27+
with:
28+
library_path: src/difflib_parser
29+
ref_name: ${{ needs.prepare.outputs.ref_name }}
30+
secrets: inherit

0 commit comments

Comments
 (0)