-
Notifications
You must be signed in to change notification settings - Fork 388
84 lines (78 loc) · 2.73 KB
/
prepare-release.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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
# This action will create a change logs via release-it and open a pull request,
# after the PR is merged, the action release.yml will be trigger.
name: Prepare release
on:
workflow_dispatch:
inputs:
release_branch:
description: The branch to be released
type: string
required: true
default: 'main'
version:
description: 'The version to be released'
required: true
type: string
jobs:
prepare_release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
ref: ${{ inputs.release_branch }}
fetch-depth: 0
- uses: actions/setup-node@v3
with:
node-version: 16
- name: Install release-it
run: |
npm install -g release-it
npm install -g release-it/bumper
npm install -g release-it/conventional-changelog
- name: git config
run: |
git config user.name "${GITHUB_ACTOR}"
git config user.email "${GITHUB_ACTOR}@users.noreply.github.com"
- run: |
release-it ${{ inputs.version }} \
--git.commit \
--'git.commitMessage="chore: release ${version}"' \
--no-git.tag \
--'git.tagAnnotation="Release ${version}"' \
--no-git.push \
--no-github.release \
--no-github.web \
--ci
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Get current version of pubspec.yaml
id: pubspec
run: |
PUBSPEC_VERSION=$(grep 'version: ' pubspec.yaml | sed -e 's,.*: \(.*\),\1,')
echo "pubspec version: ${PUBSPEC_VERSION}"
echo "{version}=${PUBSPEC_VERSION}" >> $GITHUB_OUTPUT
- name: Create Pull Request
id: cpr
uses: peter-evans/create-pull-request@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: "chore: release ${{ inputs.version }}"
committer: GitHub <[email protected]>
author: ${{ github.actor }} <${{ github.actor }}@users.noreply.github.com>
signoff: false
branch: prepare-release-${{ inputs.version }}
base: main
delete-branch: true
title: "chore: release ${{ inputs.version }}"
body: |
Prepare releasing **${{ inputs.version }}**
After this pull request is merged, the following steps below will be going on:
* Create tag for **${{ inputs.version }}**
* Publish to pub.dev
* Create Github release for **${{ inputs.version }}**
*This pull request is opened by bot*
labels: |
ci:skip
ci:prepare_release
reviewers: |
littleGnAl