Skip to content

Update release.yml pipeline #84

Update release.yml pipeline

Update release.yml pipeline #84

Workflow file for this run

name: release

Check failure on line 1 in .github/workflows/release.yml

View workflow run for this annotation

GitHub Actions / .github/workflows/release.yml

Invalid workflow file

You have an error in your yaml syntax
on:
push:
tags:
- v*
permissions:
contents: read
jobs:
release:
runs-on: ubuntu-latest
name: Release to PyPi
steps:
- uses: actions/checkout@v3
- name: Fetch all branches
run: git fetch --prune --unshallow
- name: Check if commit is on allowed branch
run: |
if git branch -r --contains ${{ github.sha }} | grep -Eq 'origin/master|origin/polygon-lts'; then
echo "Allowed branch"
else
echo "Commit not on master or polygon-lts; skipping"
exit 1
fi
- name: Setup Python
uses: actions/setup-python@v3
with:
python-version: "3.10"
- name: Setup Poetry
uses: abatilo/actions-poetry@v2
- name: Get package name
id: package
run: echo "name=$(sed -n '/\[tool.poetry\]/,/^\[/p' pyproject.toml | grep '^name = ' | sed 's/^name = \"//; s/\"$//')" >> $GITHUB_OUTPUT
- name: Configure Poetry
run: |
if [ "${{ steps.package.outputs.name }}" == "polygon-api-client" ]; then
poetry config pypi-token.pypi ${{ secrets.POETRY_HTTP_BASIC_PYPI_PASSWORD }}
elif [ "${{ steps.package.outputs.name }}" == "massive" ]; then
poetry config pypi-token.pypi ${{ secrets.POETRY_HTTP_BASIC_PYPI_PASSWORD_MASSIVE }}
else
echo "Unknown package name: ${{ steps.package.outputs.name }}; skipping publish"
exit 1
fi
- name: Install deps
run: poetry install
- name: Get tag
id: tag
uses: dawidd6/action-get-tag@v1
- name: Version according to tag
run: poetry version ${{ steps.tag.outputs.tag }}
- name: Build
run: poetry build
- name: Publish to PyPi
run: poetry publish