Skip to content

[QI2-1092] workflow for releases #6

[QI2-1092] workflow for releases

[QI2-1092] workflow for releases #6

Workflow file for this run

name: Releases
on:
pull_request:
push:
branches:
- master
release:
types:
- created
jobs:
publish:
name: Publish to TestPyPI
runs-on: "ubuntu-latest"
permissions:
id-token: write
steps:
- uses: actions/checkout@master
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.8"
- name: Install poetry
uses: abatilo/actions-poetry@v3
with:
poetry-version: "1.3.2"
- name: Get previous Tag
if: github.ref == 'refs/heads/master'
id: previoustag
uses: WyriHaximus/github-action-get-previous-tag@v1
- name: Set Build version
if: github.event.pull_request.merged == true
run: |
COMMIT_ID=`echo ${{ github.sha }} | head -c 8`
poetry version "${{ steps.previoustag.outputs.tag }}+$COMMIT_ID"
- name: Set Release version
if: github.event_name == 'release' && github.event.action == 'created'
run: poetry version ${{ github.ref_name }}
- name: Build poetry package
run: poetry build
- name: Publish distribution 📦 to Test PyPI
if: github.event.pull_request.merged == true
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
repository-url: https://test.pypi.org/legacy/
- name: Publish distribution 📦 to PyPI
if: github.event_name == 'release' && github.event.action == 'created'
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.PYPI_API_TOKEN }}