diff --git a/.github/workflows/package_publish.yml b/.github/workflows/package_publish.yml deleted file mode 100644 index c8dd64b..0000000 --- a/.github/workflows/package_publish.yml +++ /dev/null @@ -1,41 +0,0 @@ -name: package-publish - -on: - workflow_dispatch: - -jobs: - cd: - permissions: - id-token: write - contents: write - - runs-on: ubuntu-latest - - steps: - - name: Set up Python - uses: actions/setup-python@v4 - with: - python-version: "3.11" - - - name: Check-out repository - uses: actions/checkout@v3 - with: - fetch-depth: 0 - - - name: Install dependencies - run: | - python3 -m pip install --upgrade pip - python3 -m pip install --upgrade build - - - name: Build package - run: python3 -m build - - - name: Publish to TestPyPI - uses: pypa/gh-action-pypi-publish@release/v1 - with: - repository-url: https://test.pypi.org/legacy/ - verbose: true - - - name: Test install from TestPyPI - run: | - python -m pip install --index-url https://test.pypi.org/simple/ --no-deps quanda diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index e6e3b5b..4a6b775 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -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: hatchling version - name: Use Python Semantic Release to prepare release id: release @@ -30,35 +43,6 @@ 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 }} + - name: Check git version tag + run: git describe --tags --abbrev=0 diff --git a/pyproject.toml b/pyproject.toml index fbe09fd..30f0fa4 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "quanda" -version = "0.0.3" +dynamic = ["version"] authors = [ { name="Dilyara Bareeva", email="dilyabareeva@gmail.com" }, {name = "Galip Ümit Yolcu", email = "galip.uemit.yolcu@hhi.fraunhofer.de" }, @@ -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 @@ -89,7 +95,7 @@ name = "cz_conventional_commits" [tool.semantic_release] version_toml = ["pyproject.toml:project.version"] -branch = "main" +branch = ["main", "checkpoint_argument"] changelog_file = "CHANGELOG.md" [project.optional-dependencies]