Skip to content

Commit 47226f7

Browse files
committed
Update release action for both packages
1 parent 03e97a2 commit 47226f7

File tree

1 file changed

+24
-3
lines changed

1 file changed

+24
-3
lines changed

.github/workflows/release.yml

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,41 @@ on:
66
permissions:
77
contents: read
88
jobs:
9-
test:
9+
release:
1010
runs-on: ubuntu-latest
1111
name: Release to PyPi
1212
steps:
1313
- uses: actions/checkout@v3
14+
- name: Fetch all branches
15+
run: git fetch --prune --unshallow
16+
- name: Check if commit is on allowed branch
17+
run: |
18+
if git branch -r --contains ${{ github.sha }} | grep -Eq 'origin/master|origin/polygon-lts'; then
19+
echo "Allowed branch"
20+
else
21+
echo "Commit not on master or polygon-lts; skipping"
22+
exit 1
23+
fi
1424
- name: Setup Python
1525
uses: actions/setup-python@v3
1626
with:
1727
python-version: "3.10"
1828
- name: Setup Poetry
1929
uses: abatilo/actions-poetry@v2
30+
- name: Get package name
31+
id: package
32+
run: echo "name=$(poetry run python -c 'import toml; print(toml.load(\"pyproject.toml\")[\"tool\"][\"poetry\"][\"name\"])')" >> $GITHUB_OUTPUT
2033
- name: Configure Poetry
21-
run: poetry config pypi-token.pypi ${{ secrets.POETRY_HTTP_BASIC_PYPI_PASSWORD }}
22-
- name: Install pypi deps
34+
run: |
35+
if [ "${{ steps.package.outputs.name }}" == "polygon-api-client" ]; then
36+
poetry config pypi-token.pypi ${{ secrets.POETRY_HTTP_BASIC_PYPI_PASSWORD }}
37+
elif [ "${{ steps.package.outputs.name }}" == "massive" ]; then
38+
poetry config pypi-token.pypi ${{ secrets.POETRY_HTTP_BASIC_PYPI_PASSWORD_MASSIVE }}
39+
else
40+
echo "Unknown package name: ${{ steps.package.outputs.name }}; skipping publish"
41+
exit 1
42+
fi
43+
- name: Install deps
2344
run: poetry install
2445
- name: Get tag
2546
id: tag

0 commit comments

Comments
 (0)