Skip to content

Update release.yml

Update release.yml #14

Workflow file for this run

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 "exists=true" >> $GITHUB_OUTPUT
else
echo "exists=false" >> $GITHUB_OUTPUT
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