-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci: yet another attempt to fix publishing pipeline
- Loading branch information
Showing
1 changed file
with
17 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,6 @@ on: | |
push: | ||
branches: | ||
- main | ||
- master | ||
|
||
jobs: | ||
release: | ||
|
@@ -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 | ||
|
@@ -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/[email protected] | ||
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/[email protected] | ||
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/[email protected] | ||
|
||
- name: Publish package on TestPyPI | ||
if: "! steps.check-version.outputs.tag" | ||
if: "! steps.tag-version.outputs.tagname" | ||
uses: pypa/[email protected] | ||
with: | ||
repository-url: https://test.pypi.org/legacy/ | ||
|
||
- name: Publish the release notes | ||
uses: release-drafter/[email protected] | ||
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 }} |