Skip to content

Commit

Permalink
ci(release): fix release PR action (#9)
Browse files Browse the repository at this point in the history
* ci(release): add git user

* ci(release): add automatic tagging on merge of version PR

* ci(release): remove changelog check for version PR
  • Loading branch information
serramatutu authored Jun 17, 2024
1 parent 350f4fc commit 1a7bb20
Show file tree
Hide file tree
Showing 4 changed files with 63 additions and 27 deletions.
1 change: 1 addition & 0 deletions .github/workflows/changelog-check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ on:
jobs:
check-changelog:
runs-on: ubuntu-latest
if: "!startsWith(github.event.head_commit.message, 'version:')"
steps:
- uses: actions/checkout@v4
- run: git fetch --depth=1 origin ${{ github.event.pull_request.base.name }}
Expand Down
44 changes: 39 additions & 5 deletions .github/workflows/create-release-pr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,44 @@ jobs:

- uses: ./.github/actions/setup-python-env

- name: create release commit
- name: Batch changes
uses: miniscruff/changie-action@v2
with:
version: latest
args: batch auto

- name: Merge
uses: miniscruff/changie-action@v2
with:
version: latest
args: merge

- name: Get the latest version
id: changie-latest
uses: miniscruff/changie-action@v2
with:
version: latest
args: latest

- name: Set latest package version
id: package-version
run: |
hatch run bump-version
- uses: peter-evans/create-pull-request@v6
VERSION="${{ steps.changie-latest.outputs.output }}"
VERSION_NO_V=$(echo "$VERSION" | cut -c 2-)
hatch version "$VERSION_NO_V"
MESSAGE=$(cat ".changes/$VERSION.md")
echo "::set-output name=version::$VERSION_NO_V"
echo "::set-output name=message::$MESSAGE"
- name: Create Pull Request
uses: peter-evans/create-pull-request@v4
with:
base: main
title: "version: ${{ steps.latest.outputs.output }}"
branch: release/${{ steps.package-version.outputs.version }}
commit-message: |
"version: ${{ steps.package-version.outputs.version }}"
${{ steps.package-version.outputs.message }}
23 changes: 23 additions & 0 deletions .github/workflows/create-release-tag.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Create release tag

on:
push:
branches:
- main
paths:
- CHANGELOG.md

jobs:
create-release-tag:
runs-on: ubuntu-latest
if: "startsWith(github.event.head_commit.message, 'version:')"
steps:
- uses: actions/checkout@v4
- name: Create tag
run: |
TAG=$(hatch version)
git config user.name "release-bot"
git config user.email "[email protected]"
git tag "$TAG"
git push origin $TAG
22 changes: 0 additions & 22 deletions scripts/bump-version.sh

This file was deleted.

0 comments on commit 1a7bb20

Please sign in to comment.