Skip to content

Update version to 0.2.0 #36

Update version to 0.2.0

Update version to 0.2.0 #36

name: Create new release
on:
pull_request:
branches:
- main
types:
- closed
env:
tag-prefix: "v"
jobs:
push-tag:
name: Push a tag
if: ${{ contains(github.event.pull_request.labels.*.name, 'new release') && github.event.pull_request.merged }}
runs-on: ubuntu-latest
permissions:
contents: write
outputs:
version: ${{ steps.tag.outputs.version }}
tag: ${{ steps.tag.outputs.tag }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install Hatch
uses: pypa/hatch@install
- name: Configure git
run: |
git config user.name 'github-actions[bot]'
git config user.email 'github-actions[bot]@users.noreply.github.com'
- name: Push a tag
id: tag
run: |
version="$(hatch version)"
tag="${{ env.tag-prefix }}${version}"
git tag -a ${tag} -m "New release ${tag} (tagged by github-actions[bot])"
git push origin ${tag}
echo "version=${version}" >> $GITHUB_OUTPUT
echo "tag=${tag}" >> $GITHUB_OUTPUT
build-package:
needs:
- push-tag
uses: ./.github/workflows/build-pip-package.yml
with:
version: ${{ needs.push-tag.outputs.version }}
create-release:
name: Create a release
runs-on: ubuntu-latest
needs:
- push-tag
- build-package
permissions:
contents: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Download artifacts
uses: actions/download-artifact@v4
with:
path: dist
pattern: pip-package--*
merge-multiple: true
- name: Create a release
uses: softprops/action-gh-release@v2
with:
draft: true
tag_name: ${{ needs.push-tag.outputs.tag }}
generate_release_notes: true
files: dist/*