Skip to content

Commit 0fcbeb0

Browse files
committed
release fix
1 parent 26ce0c9 commit 0fcbeb0

File tree

1 file changed

+10
-20
lines changed

1 file changed

+10
-20
lines changed

.github/workflows/release.yml

Lines changed: 10 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,9 @@ on:
66
- created
77

88
jobs:
9-
109
release:
11-
1210
runs-on: ubuntu-latest
13-
1411
steps:
15-
1612
- uses: actions/checkout@v2
1713

1814
- name: "Set up Python 3.9"
@@ -36,32 +32,26 @@ jobs:
3632
- name: "Build Package"
3733
run: make build
3834

35+
- name: Get branch names
36+
id: branch-name
37+
uses: tj-actions/branch-names@v5.1
38+
3939
- name: "Publish to Test PyPi"
40+
if: steps.branch-name.outputs.ref_branch != 'main'
4041
env:
4142
TWINE_USERNAME: __token__
4243
TWINE_PASSWORD: ${{ secrets.TEST_PYPI_PASSWORD }}
4344
TWINE_REPOSITORY_URL: https://test.pypi.org/legacy/
4445
run: |
45-
BRANCH_NAME="${GITHUB_REF#refs/heads/}"
46-
echo $BRANCH_NAME
47-
if [ $BRANCH_NAME != "main" ];
48-
then
49-
twine upload dist/*
50-
else
51-
echo "Not uploading to Test PyPi because we're in the main branch."
52-
fi
46+
echo "${{ steps.branch-name.outputs.ref_branch }}"
47+
twine upload dist/*
5348
5449
- name: "Build and Publish to PyPi"
50+
if: steps.branch-name.outputs.ref_branch == 'main'
5551
env:
5652
TWINE_USERNAME: __token__
5753
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
5854
TWINE_REPOSITORY_URL: https://upload.pypi.org/legacy/
5955
run: |
60-
BRANCH_NAME="${GITHUB_REF#refs/heads/}"
61-
echo $BRANCH_NAME
62-
if [ $BRANCH_NAME == "main" ];
63-
then
64-
twine upload dist/*
65-
else
66-
echo "Not uploading to PyPi because we're not in the main branch."
67-
fi
56+
echo "${{ steps.branch-name.outputs.ref_branch }}"
57+
twine upload dist/*

0 commit comments

Comments
 (0)