-
Notifications
You must be signed in to change notification settings - Fork 4
84 lines (80 loc) · 2.57 KB
/
merge.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
name: "Merge"
on:
push:
# TODO: Remove
pull_request:
types: [closed]
branches:
- main
jobs:
changes:
runs-on: ubuntu-latest
timeout-minutes: 5
outputs:
any_changed: ${{ steps.changed-files.outputs.all_changed_files_count }}
# if: github.event.pull_request.mergedTODO:
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Get all changed *.dart, files in docs or pubspec.yaml
id: changed-files
uses: tj-actions/changed-files@v41
bump_and_tag:
runs-on: ubuntu-latest
timeout-minutes: 20
needs: changes
if: needs.changes.outputs.any_changed != '0'
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ github.head_ref }}
- name: Setup Dart SDK
uses: dart-lang/[email protected]
- name: install cider
run: dart pub global activate cider
- name: Change flutter version tag
run: |
echo "FLUTTER_BUILD_VERSION=$(cider bump patch --bump-build)" >> "$GITHUB_ENV"
- name: Update
id: update
run: |
git config --global user.name "github-actions"
git config --global user.email "[email protected]"
git add -A
git commit --amend --no-edit
git push -f
echo "newSha=$(git rev-parse ${{github.event.pull_request.head.sha}})" >> $GITHUB_ENV
- name: Create tag
uses: actions/github-script@v6
with:
script: |
github.rest.git.createRef({
owner: context.repo.owner,
repo: context.repo.repo,
ref: 'refs/tags/${{env.FLUTTER_BUILD_VERSION}}',
sha: "${{env.newSha}}"
})
- name: Update CHANGELOG
id: changelog
uses: requarks/changelog-action@v1
with:—
token: ${{ github.token }}
tag: ${{env.FLUTTER_BUILD_VERSION}}
excludeTypes: ""
includeInvalidCommits: true
- name: release
uses: actions/github-script@v5
if: ${{ (steps.bump.outputs.release == 'true') && (env.modified == 'true') }}
with:
script: |
github.rest.repos.createRelease({
draft: false,
generate_release_notes: true,
name: "${{steps.bump.outputs.version}}",
owner: context.repo.owner,
prerelease: false,
repo: context.repo.repo,
tag_name: "${{steps.bump.outputs.version}}",
});