Skip to content

Commit 1fdf74b

Browse files
committed
Update publish step
1 parent 4e64da0 commit 1fdf74b

File tree

3 files changed

+12
-7
lines changed

3 files changed

+12
-7
lines changed

.github/workflows/python-package.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
strategy:
1818
fail-fast: false
1919
matrix:
20-
python-version: [3.6, 3.7, 3.8]
20+
python-version: [3.8]
2121
steps:
2222
- uses: actions/checkout@v2
2323
- name: Set up Python ${{ matrix.python-version }}

.github/workflows/python-publish.yaml

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,10 @@ on:
1414

1515
jobs:
1616
deploy:
17-
17+
env:
18+
PUBLISH_TAG: ${GITHUB_REF#refs/*/}
19+
VERSION_FILE: $(basename $GITHUB_REPOSITORY)/VERSION
1820
runs-on: ubuntu-latest
19-
2021
steps:
2122
- uses: actions/checkout@v2
2223
- name: Set up Python
@@ -27,12 +28,16 @@ jobs:
2728
run: |
2829
python -m pip install --upgrade pip
2930
pip install build
30-
- name: Update VERSION
31+
- name: Check VERSION
3132
run: |
32-
echo "${GITHUB_REF#refs/*/}" > carsons/VERSION
33+
if ! echo ${{ env.PUBLISH_TAG }} | grep -P -e "^\d+\.\d+\.\d+((rc|alpha)\d+)?$"; then
34+
echo "Tag ${{ env.PUBLISH_TAG }} doesn't match x.y.z pattern. Not pushing.";
35+
exit 1;
36+
fi
3337
- name: Build package
3438
run: |
35-
echo "Building $(cat carsons/VERSION)"
39+
echo "Building ${{ env.PUBLISH_TAG }}"
40+
echo ${{ env.PUBLISH_TAG }} > ${{ env.VERSION_FILE }}
3641
python -m build
3742
- name: Publish package
3843
uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29

carsons/VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.0.2
1+
unreleased

0 commit comments

Comments
 (0)