-
Notifications
You must be signed in to change notification settings - Fork 0
128 lines (109 loc) · 4.43 KB
/
Copy pathbump-version-flutter-lib.yml
File metadata and controls
128 lines (109 loc) · 4.43 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
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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
name: bump version / flutter lib
on:
workflow_call:
inputs:
level:
description: Bump level
required: true
type: string
secrets:
APP_ID:
description: GitHub App installation ID
required: true
APP_PRIVATE_KEY:
description: GitHub App private key
required: true
jobs:
prepare_next_release:
name: prepare next release
runs-on: ubuntu-latest
steps:
- name: Validate bump level
env:
INPUTS_LEVEL: ${{ inputs.level }}
run: |
case "${INPUTS_LEVEL}" in
major|minor|patch) ;;
*)
echo "::error::Invalid level '${INPUTS_LEVEL}' (expected major, minor, or patch)."
exit 1
;;
esac
- id: generate_token
name: Generate a GitHub App token
uses: actions/create-github-app-token@bcd2ba49218906704ab6c1aa796996da409d3eb1
with:
client-id: ${{ secrets.APP_ID }}
private-key: ${{ secrets.APP_PRIVATE_KEY }}
permission-contents: write
permission-pull-requests: write
- name: Checkout source code
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0
with:
token: ${{ steps.generate_token.outputs.token }}
ref: main
fetch-depth: 0
persist-credentials: false
- name: Add Toolbox Envy to PATH
uses: EarthmanMuons/toolbox-envy/.github/actions/add-to-path@main
with:
include_bins: |
common
flutter
- name: Configure Git identity
run: |
git config user.name "senile-errata[bot]"
git config user.email "senile-errata@users.noreply.github.com"
- name: Set up Flutter
uses: subosito/flutter-action@1a449444c387b1966244ae4d4f8c696479add0b2
with:
channel: stable
flutter-version-file: pubspec.yaml
cache: true
- name: Install dependencies
run: flutter pub get --enforce-lockfile
- name: Bump ${{ inputs.level }} version for project
env:
INPUTS_LEVEL: ${{ inputs.level }}
run: |
get-project-version | bump-semver --"${INPUTS_LEVEL}" | set-project-version
- name: Bump CHANGELOG version to match
run: get-project-version | bump-changelog-version
- name: Fix up CHANGELOG formatting
run: npx --yes prettier@latest --color --prose-wrap always --write -- **/CHANGELOG.md
- name: Rotate unreleased whatsnew docs into release directory
run: get-project-version | rotate-whatsnew
- id: version
name: Get the new release version
run: |
echo "release_version=$(get-project-version)" >>"$GITHUB_OUTPUT"
- id: cpr
name: Create pull request
uses: peter-evans/create-pull-request@5f6978faf089d4d20b00c7766989d076bb2fc7f1
with:
token: ${{ steps.generate_token.outputs.token }}
branch: release/bump-version
branch-suffix: timestamp
commit-message: Release v${{ steps.version.outputs.release_version }}
title: Prepare the v${{ steps.version.outputs.release_version }} ${{ inputs.level }} release
body: |-
This PR was automatically created by the [bump-version](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}) workflow, which ran the following commands:
```
$ get-project-version | bump-semver --${{ inputs.level }} | set-project-version
$ get-project-version | bump-changelog-version
$ get-project-version | rotate-whatsnew
```
**Please review the submitted changes.**
Once this PR is merged into the _main_ branch, an automated process will tag the commit and create a draft GitHub Release with signed assets attached for final review before publishing.
- name: Annotate workflow run with PR URL
env:
INPUTS_LEVEL: ${{ inputs.level }}
STEPS_VERSION_OUTPUTS_RELEASE_VERSION: ${{ steps.version.outputs.release_version }}
STEPS_CPR_OUTPUTS_PULL_REQUEST_URL: ${{ steps.cpr.outputs.pull-request-url }}
run: |
set -euo pipefail
{
echo "### :shipit: Opened pull request for ${INPUTS_LEVEL} release v${STEPS_VERSION_OUTPUTS_RELEASE_VERSION}"
echo
echo "- ${STEPS_CPR_OUTPUTS_PULL_REQUEST_URL}"
} >>"$GITHUB_STEP_SUMMARY"