-
Notifications
You must be signed in to change notification settings - Fork 4
62 lines (56 loc) · 2.13 KB
/
release_pr_workflow.yml
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
60
61
62
# The workflow to create PRs with release commits.
name: Create release PR
on:
workflow_dispatch:
inputs:
release_version:
description: "Release version '0.1.2' (without 'v')"
required: true
snapshot_version:
description: "Snapshot version '0.2.0-SNAPSHOT' (without 'v')"
required: true
permissions:
contents: write
pull-requests: write
jobs:
create_release_pr:
name: Create release PR (job)
runs-on: ubuntu-latest
steps:
- name: Check versions
run: |
echo "Checking release version..."
if echo ${{ github.event.inputs.release_version }} | grep --invert-match '^[0-9]\+\.[0-9]\+\.[0-9]\+$' > /dev/null; then
echo "Release version is invalid"
exit 1
fi
echo "Checking snapshot version..."
if echo ${{ github.event.inputs.snapshot_version }} | grep --invert-match '^[0-9]\+\.[0-9]\+\.[0-9]\+-SNAPSHOT$' > /dev/null; then
echo "Snapshot version is invalid"
exit 1
fi
- name: Checkout main
uses: actions/checkout@v4
with:
ref: main
fetch-depth: 0
- name: Create release commits
run: |
git config --local user.name "GitHub Action"
git config --local user.email "[email protected]"
sed -i -e "s/^version=.\+$/version=${{ github.event.inputs.release_version }}/g" gradle.properties
git add gradle.properties
git commit -m "Release version ${{ github.event.inputs.release_version }}"
sed -i -e "s/^version=.\+$/version=${{ github.event.inputs.snapshot_version }}/g" gradle.properties
git add gradle.properties
git commit -m "Bump version to ${{ github.event.inputs.snapshot_version }}"
- name: Create Pull Request
uses: peter-evans/create-pull-request@v3
with:
branch: release-${{ github.event.inputs.release_version }}
delete-branch: true
draft: true
title: Release version ${{ github.event.inputs.release_version }}
body: |
Proposed changelog:
- *fill in*