Skip to content

Commit 274941c

Browse files
committed
chore(ci): only publish to PyPI if a new release was created
1 parent 6bfd52a commit 274941c

File tree

1 file changed

+17
-12
lines changed

1 file changed

+17
-12
lines changed

.github/workflows/release.yaml

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
name: Generate Next Release
22
# This workflow will generate changelog and release notes.
3-
# Source: https://github.com/terraform-aws-modules/terraform-aws-vpc/blob/master/.github/workflows/release.yml
43

54
on:
65
workflow_dispatch:
@@ -9,7 +8,7 @@ env:
98
DIST_DIR: dist
109
jobs:
1110
release:
12-
name: Build and publish package
11+
name: Create next release
1312
runs-on: ubuntu-latest
1413
permissions:
1514
id-token: write
@@ -21,15 +20,6 @@ jobs:
2120
fetch-depth: 0
2221
ssh-key: ${{ secrets.DEPLOY_KEY }}
2322

24-
- name: Install Python
25-
uses: actions/setup-python@v5
26-
with:
27-
python-version-file: .python-version
28-
29-
- name: Install dependencies
30-
run: |
31-
python -m pip install --upgrade build
32-
3323
- name: Create GitHub release
3424
uses: cycjimmy/semantic-release-action@v4
3525
with:
@@ -46,11 +36,26 @@ jobs:
4636
GIT_COMMITTER_EMAIL: bot@equinix.noreply.github.com
4737
RELEASE_REQUESTER: "@${{ github.event.sender.login }}"
4838

39+
publish:
40+
name: Publish artifacts
41+
runs-on: ubuntu-latest
42+
needs: release
43+
if: needs.release.outputs.release-published == 'true'
44+
steps:
45+
- name: Install Python
46+
uses: actions/setup-python@v5
47+
with:
48+
python-version-file: .python-version
49+
50+
- name: Install dependencies
51+
run: |
52+
python -m pip install --upgrade build
53+
4954
- name: Build package
5055
run: |
5156
python -m build --sdist --wheel --outdir ${{ env.DIST_DIR }} .
5257
53-
- name: Publish package
58+
- name: Publish to PyPI
5459
uses: pypa/gh-action-pypi-publish@release/v1
5560
with:
5661
packages-dir: ${{ env.DIST_DIR }}

0 commit comments

Comments
 (0)