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

ci: yet another attempt to fix publishing pipeline #47

Merged
merged 1 commit into from
Aug 14, 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
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 }}
Loading