forked from psk907/fluttermoji
-
Notifications
You must be signed in to change notification settings - Fork 0
76 lines (70 loc) · 1.94 KB
/
main-workflow.yaml
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
name: Main workflow
on:
push:
branches:
- main
paths-ignore:
- '.gitignore'
- '.metadata'
- 'README.md'
- '.github/**'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
permissions:
contents: write
jobs:
get_version:
name: Retrieve version
runs-on: ubuntu-latest
outputs:
version: ${{ steps.split.outputs._0 }}
steps:
- uses: actions/checkout@v4
- name: Get the version from the pubspec
id: pubspecVersion
uses: CumulusDS/get-yaml-paths-action@v1.0.2
with:
file: pubspec.yaml
version: version
- uses: jungwinter/split@v2
id: split
with:
msg: ${{ steps.pubspecVersion.outputs.version }}
separator: '+'
tests:
name: Tests & checks
runs-on: ubuntu-latest
steps:
#### SETUP ####
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: '17'
- uses: subosito/flutter-action@v2
with:
channel: 'stable'
cache: true
- run: flutter doctor
- name: Get dependencies
run: flutter pub get
- name: Generate files
run: |
flutter pub run build_runner build --delete-conflicting-outputs
flutter pub get # Temporary until https://github.com/flutter/flutter/issues/148333 is solved
### CHECKS ###
- name: Analyze code
run: flutter analyze
- name: Run tests
run: flutter test --coverage
create_release:
name: Create GitHub pre-release
needs:
- get_version
- tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Create pre-release
run: |
gh release create pre-${{ needs.get_version.outputs.version }}+${{github.run_number}} --title v${{ needs.get_version.outputs.version }} -R '${{ github.repository }}' --prerelease --generate-notes