refs/heads/58-push-a-tag-after-testing-artifacts #52
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 new release | |
on: | |
pull_request: | |
branches: | |
- main | |
types: | |
- closed | |
env: | |
tag-prefix: "v" | |
jobs: | |
get-tag-name: | |
if: ${{ contains(github.event.pull_request.labels.*.name, 'new release') && github.event.pull_request.merged }} | |
name: Get current version | |
runs-on: ubuntu-latest | |
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: Get current version and create tag name | |
id: tag | |
run: | | |
version="$(hatch version)" | |
tag="${{ env.tag-prefix }}${version}" | |
echo "version=${version}" >> $GITHUB_OUTPUT | |
echo "tag=${tag}" >> $GITHUB_OUTPUT | |
build-package: | |
needs: | |
- get-tag-name | |
uses: ./.github/workflows/build-pip-package.yml | |
with: | |
version: ${{ needs.get-tag-name.outputs.version }} | |
build-docs: | |
needs: | |
- get-tag-name | |
uses: ./.github/workflows/build-docs.yml | |
push-tag: | |
name: Push a tag | |
needs: | |
- get-tag-name | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
outputs: | |
tag: ${{ steps.tag.outputs.tag }} | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- 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: | | |
tag=${{ needs.get-tag-name.outputs.tag }} | |
git tag -a ${tag} -m "New release ${tag} (tagged by github-actions[bot])" | |
git push origin ${tag} | |
echo "tag=${tag}" >> $GITHUB_OUTPUT | |
create-release: | |
name: Create a release | |
runs-on: ubuntu-latest | |
needs: | |
- build-package | |
- build-docs | |
- push-tag | |
permissions: | |
contents: write | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Download artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
path: dist | |
pattern: release--* | |
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/* |