Skip to content

Commit 15a9fef

Browse files
dzhalaevdseifertm
authored andcommitted
feat(workflows): add gh release instead of ncipollo/release-action
1 parent df9239b commit 15a9fef

File tree

1 file changed

+26
-10
lines changed

1 file changed

+26
-10
lines changed

.github/workflows/main.yml

Lines changed: 26 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -193,16 +193,32 @@ jobs:
193193
path: dist
194194
- name: Create GitHub Release
195195
if: github.event_name == 'push' && contains(github.ref, 'refs/tags/')
196-
uses: ncipollo/release-action@339a81892b84b4eeb0f6e744e4574d79d0d9b8dd # v1.21.0
197-
with:
198-
name: pytest-asyncio ${{ needs.build.outputs.version }}
199-
artifacts: dist/*
200-
bodyFile: release-notes.md
201-
prerelease: ${{ needs.build.outputs.prerelease }}
202-
token: ${{ secrets.GITHUB_TOKEN }}
203-
allowUpdates: true
204-
draft: true
205-
skipIfReleaseExists: true
196+
env:
197+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
198+
VERSION: ${{ needs.build.outputs.version }}
199+
PRERELEASE: ${{ needs.build.outputs.prerelease }}
200+
run: |
201+
TAG_NAME="${GITHUB_REF#refs/tags/}"
202+
203+
IS_DRAFT=$(gh release view "${TAG_NAME}" --json isDraft --jq '.isDraft' 2>/dev/null || echo "")
204+
if [ -n "${IS_DRAFT}" ]; then
205+
if [ "${IS_DRAFT}" = "false" ]; then
206+
exit 0
207+
fi
208+
gh release edit "${TAG_NAME}" \
209+
--title "pytest-asyncio ${VERSION}" \
210+
--notes-file release-notes.md \
211+
--draft
212+
213+
gh release upload "${TAG_NAME}" dist/* --clobber
214+
else
215+
gh release create "${TAG_NAME}" \
216+
--title "pytest-asyncio ${VERSION}" \
217+
--notes-file release-notes.md \
218+
--draft \
219+
$( [ "${PRERELEASE}" = "true" ] && echo "--prerelease" ) \
220+
dist/*
221+
fi
206222
207223
publish-test-pypi:
208224
name: Publish packages to test.pypi.org

0 commit comments

Comments
 (0)