Skip to content

Commit 3076989

Browse files
committed
Update build-test-deploy.yml
1 parent a37048c commit 3076989

1 file changed

Lines changed: 13 additions & 1 deletion

File tree

.github/workflows/build-test-deploy.yml

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,19 +73,31 @@ jobs:
7373
npm install -g @semantic-release/git
7474
npm install -g @semantic-release/github
7575
76+
- name: Get the next release from semantic release
77+
id: next_release
78+
env:
79+
GH_TOKEN: ${{ secrets.GH_TOKEN }}
80+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
81+
run: echo ::set-output name=NEXT_RELEASE::$(npx semantic-release --dry-run | grep -oP "Published release \K[0-9]+\.[0-9]+\.[0-9]+") #null if no published release
82+
7683
- name: Publish to git releases and tags
84+
if: ${{ steps.next_release.outputs.NEXT_RELEASE != null }}
7785
env:
7886
GH_TOKEN: ${{ secrets.GH_TOKEN }}
7987
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
80-
run: npx semantic-release #--dry-run
88+
run: |
89+
echo "The next release is ${{ steps.next_release.outputs.NEXT_RELEASE }}"
90+
npx semantic-release
8191
8292
- name: Build project
93+
if: ${{ steps.next_release.outputs.NEXT_RELEASE != null }}
8394
run: |
8495
pip install -U pip
8596
pip install build
8697
python -m build
8798
8899
- name: Publish to pypi
100+
if: ${{ steps.next_release.outputs.NEXT_RELEASE != null }}
89101
uses: pypa/gh-action-pypi-publish@release/v1
90102
with:
91103
user: ${{ secrets.PYPI_USER }}

0 commit comments

Comments
 (0)