Skip to content

main -> create_draft_release ( 1 ) #8

main -> create_draft_release ( 1 )

main -> create_draft_release ( 1 ) #8

---
name: create_draft_release
# yamllint disable rule:line-length
on:
workflow_dispatch:
# set the run-name
run-name: ${{ github.ref_name }} -> create_draft_release (
${{ github.run_attempt }}
)
jobs:
create_draft_release:
name: create_draft_release
runs-on: ubuntu-latest
permissions:
id-token: write
contents: write
steps:
- name: Echo current date and time
id: datetime
run: |
echo "datetime: $(date '+%Y-%m-%d %H:%M:%S')"
- name: Checkout
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.13
- name: Update pip and install hatch
run: |
export PIP_ROOT_USER_ACTION=ignore
pip install --upgrade pip
pip install hatch
- name: Get version
id: get_version
run: |
export version=$(hatch version)
echo "version=$version" >> $GITHUB_OUTPUT
#validates that the version is a valid semver
- name: Validate version
id: validate_version
run: |
if [[ ! ${{ steps.get_version.outputs.version }} =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
echo "Invalid version: ${{ steps.get_version.outputs.version }}"
exit 1
fi
- name: Create release branch
run: |
git checkout -b "release/v${{ steps.get_version.outputs.version }}"
git push origin "release/v${{ steps.get_version.outputs.version }}"
- name: Create DRAFT release through github cli and upload assets
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release create v${{ steps.get_version.outputs.version }} --title v${{ steps.get_version.outputs.version }} --generate-notes --draft