Skip to content

Commit

Permalink
[CQT-153] Add release workflow (#352)
Browse files Browse the repository at this point in the history
  • Loading branch information
oschusler authored Oct 10, 2024
1 parent 4d76942 commit f541e8c
Showing 1 changed file with 56 additions and 0 deletions.
56 changes: 56 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: Releases

on:
pull_request:
push:
branches:
- "release-*"
release:
types:
- created

jobs:
publish:
name: Publish assets
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.11"
- name: Install poetry
uses: abatilo/actions-poetry@v3
with:
poetry-version: "1.8.3"

# Setting the proper version
- name: Get previous Tag
if: contains(github.ref, 'refs/heads/release-')
id: previous_tag
uses: WyriHaximus/github-action-get-previous-tag@v1
with:
fallback: 0.1.0
- name: Set Build version
if: contains(github.ref, 'refs/heads/release-')
run: poetry version "${{ steps.previous_tag.outputs.tag }}.dev${{ github.run_number }}"
- name: Set Release version
if: github.event_name == 'release' && github.event.action == 'created'
run: poetry version ${{ github.ref_name }}

# Build package
- name: Build poetry package
run: poetry build

# Publishing the package
- name: Publish distribution 📦 to Test PyPI
if: contains(github.ref, 'refs/heads/release-')
uses: pypa/gh-action-pypi-publish@release/v1
with:
repository-url: https://test.pypi.org/legacy/
verbose: true
- name: Publish distribution 📦 to PyPI
if: github.event_name == 'release' && github.event.action == 'created'
uses: pypa/gh-action-pypi-publish@release/v1

0 comments on commit f541e8c

Please sign in to comment.