Skip to content

Commit

Permalink
[QI2-1092] set flow for pr, merges to master and releases
Browse files Browse the repository at this point in the history
  • Loading branch information
napocornejo committed Oct 9, 2024
1 parent 8c14ce3 commit fe61842
Showing 1 changed file with 17 additions and 12 deletions.
29 changes: 17 additions & 12 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ name: Releases

on:
pull_request:
push:
branches:
- master
push:
branches:
- master
release:
types:
- created
Expand All @@ -17,8 +17,6 @@ jobs:
id-token: write
steps:
- uses: actions/checkout@master
- name: Create commit identifier
run: echo "COMMIT_ID=`echo ${{ github.sha }} | head -c 5`" >> $GITHUB_ENV
- name: Set up Python
uses: actions/setup-python@v5
with:
Expand All @@ -27,21 +25,28 @@ jobs:
uses: abatilo/actions-poetry@v3
with:
poetry-version: "1.3.2"
- name: Version poetry package for test
if: endsWith(github.ref, '/merge')
run: poetry version "`poetry version | awk '{print $2}'`+$COMMIT_ID"
- name: Version poetry package for release
if: startsWith(github.ref, 'refs/tags')
run: poetry version "${{ github.ref_name }}+$COMMIT_ID"
- 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: startsWith(github.ref, 'refs/tags')
if: github.event_name == 'release' && github.event.action == 'created'
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.PYPI_API_TOKEN }}

0 comments on commit fe61842

Please sign in to comment.