Skip to content

Commit

Permalink
ci: yet another attempt to fix publishing pipeline
Browse files Browse the repository at this point in the history
  • Loading branch information
bruno-fs committed Aug 13, 2024
1 parent 60f4b07 commit 0335fb4
Showing 1 changed file with 17 additions and 12 deletions.
29 changes: 17 additions & 12 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ on:
push:
branches:
- main
- master

jobs:
release:
Expand All @@ -15,7 +14,6 @@ jobs:
url: https://pypi.org/p/django-json-agg
permissions:
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
contents: write # Required for pushing tags - https://docs.github.com/en/actions/writing-workflows/workflow-syntax-for-github-actions#permissions
steps:
- name: Check out the repository
uses: actions/checkout@v3
Expand All @@ -42,39 +40,46 @@ jobs:
run: |
echo "::set-output name=sha::$(git rev-parse --verify --quiet HEAD^)"
- name: Detect and tag new version
- name: Check version
id: check-version
if: steps.check-parent-commit.outputs.sha
uses: salsify/action-detect-and-tag-new-version@v2.0.3
run: |
echo "::set-output name=version::$(poetry version -s)"
- name: Tag new version if it doesn't exist
id: tag-version
if: steps.check-version.outputs.version
uses: butlerlogic/action-autotag@1.1.4
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
with:
version-command: |
bash -o pipefail -c "poetry version | awk '{ print \$2 }'"
version: "${{ steps.check-version.outputs.version }}"

- name: Bump version for developmental release
if: "! steps.check-version.outputs.tag"
if: "! steps.tag-version.outputs.tagname"
run: |
poetry version patch &&
version=$(poetry version | awk '{ print $2 }') &&
version=$(poetry version -s) &&
poetry version $version.dev.$(date +%s)
- name: Build package
run: |
poetry build --ansi
- name: Publish package on PyPI
if: steps.check-version.outputs.tag
if: steps.tag-version.outputs.tagname
uses: pypa/gh-action-pypi-publish@v1.9.0

- name: Publish package on TestPyPI
if: "! steps.check-version.outputs.tag"
if: "! steps.tag-version.outputs.tagname"
uses: pypa/gh-action-pypi-publish@v1.9.0
with:
repository-url: https://test.pypi.org/legacy/

- name: Publish the release notes
uses: release-drafter/release-drafter@v6.0.0
with:
publish: ${{ steps.check-version.outputs.tag != '' }}
tag: ${{ steps.check-version.outputs.tag }}
publish: ${{ steps.tag-version.outputs.tagname != '' }}
tag: ${{ steps.tag-version.outputs.tagname }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 comments on commit 0335fb4

Please sign in to comment.