Skip to content

Commit

Permalink
fix: merge package_publish.yml and release.yml, use hatch.vcs
Browse files Browse the repository at this point in the history
  • Loading branch information
dilyabareeva committed Nov 22, 2024
1 parent d345e43 commit f7a83e3
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 76 deletions.
41 changes: 0 additions & 41 deletions .github/workflows/package_publish.yml

This file was deleted.

47 changes: 14 additions & 33 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,22 @@ jobs:
python-version: "3.11"

- name: Check-out repository
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ github.sha }}

- name: Install dependencies
run: |
python3 -m pip install --upgrade pip
python3 -m pip install --upgrade build hatchling hatch-vcs
- name: Setup | Force correct release branch on workflow sha
run: |
git checkout -B ${{ github.ref_name }} ${{ github.sha }}
- name: Verify dynamic version
run: hatch version

- name: Use Python Semantic Release to prepare release
id: release
Expand All @@ -30,35 +43,3 @@ jobs:
changelog: true
tag: true
commit: false
build: false

- name: Push changes to a new branch and create a PR
run: |
# Create a new branch from main
git checkout -b version-bump-${{ steps.release.outputs.tag }}
# Add the changes made by semantic-release (version update and changelog)
git add pyproject.toml CHANGELOG.md
# Commit the changes (version bump and changelog update)
git commit -m "chore: bump version to ${{ steps.release.outputs.tag }} and update changelog"
# Push changes to the new branch
git push origin version-bump-${{ steps.release.outputs.tag }}
# Create a pull request using GitHub CLI (gh)
gh pr create --base main --head version-bump-${{ steps.release.outputs.tag }} --title "chore: Version bump to ${{ steps.release.outputs.tag }}" --body "Automated version bump"
env:
GITHUB_TOKEN: ${{ secrets.QUANDA_ADMIN }}

- name: Merge the Pull Request
run: |
# Find the PR number for the created branch
PR_NUMBER=$(gh pr list --state open --head version-bump-${{ steps.release.outputs.tag }} --json number --jq '.[0].number')
# Merge the PR
gh pr merge $PR_NUMBER --merge --admin
env:
GITHUB_TOKEN: ${{ secrets.QUANDA_ADMIN }}
10 changes: 8 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "quanda"
version = "0.0.3"
dynamic = ["version"]
authors = [
{ name="Dilyara Bareeva", email="[email protected]" },
{name = "Galip Ümit Yolcu", email = "[email protected]" },
Expand Down Expand Up @@ -35,12 +35,18 @@ Homepage = "https://github.com/dilyabareeva/quanda"
Issues = "https://github.com/dilyabareeva/quanda/issues"

[build-system]
requires = ["hatchling"]
requires = ["hatchling", "hatch-vcs"]
build-backend = "hatchling.build"

[tool.hatch.metadata]
allow-direct-references = true

[tool.hatch.version]
source = "vcs"

[tool.hatch.version.git]
tag_pattern = "v*"

[tool.isort]
profile = "black"
line_length = 79
Expand Down

0 comments on commit f7a83e3

Please sign in to comment.