-
-
Notifications
You must be signed in to change notification settings - Fork 0
59 lines (53 loc) · 2.02 KB
/
release-automation.yml
File metadata and controls
59 lines (53 loc) · 2.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
name: Release Automation
on:
pull_request:
types: [closed]
jobs:
create_release:
# We only run it for merged PRs from a release/* branch into master.
if: |
github.event.pull_request.merged == true &&
github.event.pull_request.base.ref == 'master' &&
startsWith(github.event.pull_request.head.ref, 'release/')
runs-on: ubuntu-latest
permissions:
contents: write # to create tags and releases
pull-requests: write # to create PR
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
# We check out the master branch, which is the state after the merge.
ref: 'master'
fetch-depth: 0
- name: Get Version
id: get_version
run: |
# Извлекаем версию из pyproject.toml
version=$(grep '^version = ' pyproject.toml | sed 's/version = "\(.*\)"/\1/')
echo "version=${version}" >> $GITHUB_OUTPUT
- name: Extract Changelog Notes
id: changelog
uses: mindsers/changelog-reader-action@v2
with:
version: ${{ steps.get_version.outputs.version }}
path: ./CHANGELOG.md
- name: Create GitHub Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: v${{ steps.get_version.outputs.version }}
release_name: v${{ steps.get_version.outputs.version }}
body: ${{ steps.changelog.outputs.changes }}
draft: false
prerelease: false
- name: Create back-merge PR to dev
uses: repo-sync/pull-request@v2
with:
source_branch: "master"
destination_branch: "dev"
pr_title: "Post-Release: Merge master back into dev"
pr_body: "Automated PR to sync master back into dev after release v${{ steps.get_version.outputs.version }}."
github_token: ${{ secrets.GITHUB_TOKEN }}