diff --git a/.github/workflows/bump-version.yaml b/.github/workflows/bump-version.yaml deleted file mode 100644 index d275ce6..0000000 --- a/.github/workflows/bump-version.yaml +++ /dev/null @@ -1,72 +0,0 @@ -name: Bump version and changelog -on: - workflow_dispatch - -jobs: - bumpversion: - runs-on: ubuntu-latest - permissions: - contents: write - outputs: - version: ${{ steps.tag_version.outputs.new_version }} - previous_tag: ${{ steps.tag_version.outputs.previous_tag }} - bump_commit_sha: ${{ steps.bumpversion.outputs.commit_hash }} - pr_number: ${{ steps.cpr.outputs.pull-request-number }} - steps: - - uses: actions/checkout@v4 - - name: Get next version - id: tag_version - uses: mathieudutour/github-tag-action@v6.2 - with: - github_token: ${{ secrets.GITHUB_TOKEN }} - default_bump: false - default_prerelease_bump: false - dry_run: true - - name: Set up Python 3.12 - uses: actions/setup-python@v5 - with: - python-version: "3.12" - - name: Create bumpversion - if: steps.tag_version.outputs.new_version - id: bumpversion - run: | - pip install bump2version - bump2version --new-version ${{ steps.tag_version.outputs.new_version }} setup.cfg tutorprint_course_certificates/__about__.py .ci/config.yml - - name: Update Changelog - if: steps.tag_version.outputs.new_version - uses: stefanzweifel/changelog-updater-action@v1.11.0 - with: - latest-version: v${{ steps.tag_version.outputs.new_version }} - release-notes: ${{ steps.tag_version.outputs.changelog }} - - name: Push branch - if: steps.tag_version.outputs.new_version - run: | - branch_name="bot/v${{ steps.tag_version.outputs.new_version }}" - git fetch --prune origin - if git show-ref --quiet refs/remotes/origin/$branch_name; then - git push --delete origin $branch_name - fi - git checkout -b $branch_name || git checkout $branch_name - git push origin $branch_name - - name: Create Pull Request - id: cpr - uses: peter-evans/create-pull-request@v7 - with: - token: ${{ secrets.SEMANTIC_RELEASE_GITHUB_TOKEN }} - title: "chore: preparing release ${{ steps.tag_version.outputs.new_version }}" - commit-message: "chore: preparing release ${{ steps.tag_version.outputs.new_version }}" - branch: "bot/v${{ steps.tag_version.outputs.new_version }}" - base: main - body: | - Automated version bump for release ${{ steps.tag_version.outputs.new_version }}. - - This pull request was automatically generated. It includes the following changes: - - - Version: v${{ steps.tag_version.outputs.new_version }} - - Previous version: ${{ steps.tag_version.outputs.previous_tag }} - - ${{ steps.tag_version.outputs.changelog }} - - No code changes are included in this pull request. The purpose of this PR is to trigger a version bump for the project. - - Once the pull request is merged, a new GitHub release will be created with the updated version. diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 416b447..2ad2342 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -1,36 +1,18 @@ name: Release on: - pull_request: - types: - - closed - branches: - - main + push: + tags: + - 'v*' env: TUTOR_ROOT: ./.ci/ jobs: release: - if: github.event.pull_request.merged == true && startsWith(github.head_ref, 'bot/v') runs-on: ubuntu-latest permissions: contents: write steps: - - uses: actions/checkout@v4 - - name: Create tag - id: tag_version - uses: mathieudutour/github-tag-action@v6.2 - with: - github_token: ${{ secrets.GITHUB_TOKEN }} - default_bump: false - default_prerelease_bump: false - - name: Create a GitHub release - if: steps.tag_version.outputs.new_tag - uses: ncipollo/release-action@v1 - with: - tag: ${{ steps.tag_version.outputs.new_tag }} - name: Release ${{ steps.tag_version.outputs.new_tag }} - body: ${{ steps.tag_version.outputs.changelog }} - name: Checkout uses: actions/checkout@v4 - name: setup python