-
-
Notifications
You must be signed in to change notification settings - Fork 38
81 lines (65 loc) · 2.2 KB
/
release.yml
File metadata and controls
81 lines (65 loc) · 2.2 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
name: Release
on:
workflow_dispatch:
inputs:
version:
description: "Version: package version and git tag to create (e.g. 3.1.0)"
required: true
changelog:
description: "CHANGELOG.md notes"
required: true
default: "Bug fixes and performance improvements"
pre_release:
description: "Whether the release is a prerelease"
required: true
default: "false"
type: choice
options:
- "false"
- "true"
permissions:
contents: write
jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dart-lang/setup-dart@v1
with:
sdk: stable
- name: Install dependencies
run: dart pub get
- name: Verify formatting
run: dart format --output=none --set-exit-if-changed .
- name: Analyze
run: dart analyze --fatal-infos
- name: Run tests
run: dart test
- name: Determine version tag
id: version
run: |
TAG=${{ inputs.version }}
if [ "${{ inputs.pre_release }}" = "true" ]; then
TAG="${TAG}-dev"
fi
echo "tag=${TAG}" >> "$GITHUB_OUTPUT"
- name: Update pubspec.yaml version
run: |
sed -i "s/^version: .*/version: ${{ steps.version.outputs.tag }}/" pubspec.yaml
- name: Update CHANGELOG.md
run: |
printf '%s\n%s\n\n%s' "## ${{ steps.version.outputs.tag }}" "${{ inputs.changelog }}" "$(cat CHANGELOG.md)" > CHANGELOG.md
- name: Commit and push version bump
run: |
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git add pubspec.yaml CHANGELOG.md
git commit -m "chore: bump version to ${{ steps.version.outputs.tag }}"
git push origin HEAD:${{ github.ref_name }}
- name: Create GitHub release
uses: softprops/action-gh-release@v2
with:
tag_name: v${{ steps.version.outputs.tag }}
body: ${{ inputs.changelog }}
prerelease: ${{ inputs.pre_release == 'true' }}
target_commitish: ${{ github.ref_name }}