Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CQT-153] Add release workflow #352

Merged
merged 1 commit into from
Oct 10, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
elenbaasc marked this conversation as resolved.
Show resolved Hide resolved
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