Update release.yml #13
Workflow file for this run
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
name: Create Release and Attach Artifacts | |
on: | |
push: | |
tags: | |
- "v*.*.*" | |
jobs: | |
create-release: | |
name: Create GitHub Release and Attach Artifacts | |
runs-on: ubuntu-latest | |
environment: pypi | |
permissions: | |
contents: write # Required for Release | |
id-token: write # Required for OIDC authentication | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: ./.github/actions/build_package | |
with: | |
python-version: "3.9" | |
- name: Check Release Existence | |
id: check_release | |
run: | | |
if gh release view ${{ github.ref_name }} >/dev/null 2>&1; then | |
echo "::set-output name=exists::true" | |
else | |
echo "::set-output name=exists::false" | |
fi | |
- name: Delete Current Release | |
id: delete_release | |
if: steps.check_release.outputs.exists == 'ture' | |
run: | | |
gh release delete ${{ github.ref_name }} -y | |
env: | |
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} | |
- name: Create GitHub Release | |
id: create_release | |
run: | | |
gh release create ${{ github.ref_name }} ./dist/* \ | |
--title "${{ github.ref_name }}" \ | |
--notes "🎉 New release: ${{ github.ref_name }}" \ | |
--draft=false \ | |
--prerelease=false | |
env: | |
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} | |
- name: Publish | |
uses: pypa/gh-action-pypi-publish@release/v1 |