-
Notifications
You must be signed in to change notification settings - Fork 1
99 lines (86 loc) · 3.36 KB
/
Copy pathrelease-merge-version.yaml
File metadata and controls
99 lines (86 loc) · 3.36 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
name: Merge dev branch for release
# Controls when the workflow will run
on:
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
permissions:
contents: write
jobs:
release-project:
# The type of runner that the job will run on
runs-on: ubuntu-latest
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- name: ⬇️ Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: "dev"
- name: 📦 Setup Java
uses: actions/setup-java@v4
with:
distribution: 'adopt'
java-version: '17'
- name: ⚙️ Setup Flutter
uses: subosito/flutter-action@v2
with:
channel: 'stable'
cache: true
- name: ⚙️ Prepare Git
run: |
git config --global user.name 'github-actions[bot]'
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
- name: 📦 Get dependencies
run: flutter pub get
working-directory: ./taletime
- name: 🔑 Setup signing key
run: |
echo "${{ secrets.SIGNING_KEY_KEYSTORE }}" | base64 -d > taletime/android/app/keystore.jks
- name: Get next version
uses: ietf-tools/semver-action@v1
id: get_next_version
with:
token: ${{ github.token }}
branch: dev
- name: ⏩ Bump version
run: |
sed -i "s/^version:.*$/version: ${{ steps.get_next_version.outputs.nextStrict }}/g" taletime/pubspec.yaml
git commit -am "fix: Bumped version to ${{ steps.get_next_version.outputs.nextStrict }}"
- name: 🔹 Merge into main
run: |
git checkout main
git merge dev --no-ff
- name: 🏷️ Create tag
run: git tag ${{ steps.get_next_version.outputs.next }}
- name: 🧪 Run tests
run: flutter test
working-directory: ./taletime
- name: 📱 Build Android app
env:
SIGNING_KEY_KEY_PASSWORD: ${{ secrets.SIGNING_KEY_KEY_PASSWORD }}
SIGNING_KEY_STORE_PASSWORD: ${{ secrets.SIGNING_KEY_STORE_PASSWORD }}
run: |
flutter build apk --flavor prod --build-number $GITHUB_RUN_NUMBER
cp build/app/outputs/flutter-apk/app-prod-release.apk build/app/outputs/flutter-apk/TaleTime-${{ steps.get_next_version.outputs.nextStrict }}.apk
working-directory: ./taletime
- name: 🔹 Merge back into dev
run: |
git checkout dev
git merge main --no-ff
- name: ⏩ Prepare next dev version
run: |
NEXT_VERSION=${{ steps.get_next_version.outputs.nextStrict }}
IFS=. read -r v1 v2 v3 <<< "${NEXT_VERSION}"
DEV_VERSION="${v1}.${v2}.$((v3 + 1))"
sed -i "s/^version:.*$/version: ${DEV_VERSION}-SNAPSHOT/g" taletime/pubspec.yaml
git commit -am "fix: Prepared next dev version: ${DEV_VERSION}-SNAPSHOT"
- name: ⬆️ Push everything
run: git push origin main dev --tags
- name: 📦 Create Release
uses: softprops/action-gh-release@v2
with:
token: ${{ secrets.GITHUB_TOKEN }}
tag_name: ${{ steps.get_next_version.outputs.next }}
generate_release_notes: true
files: |
./taletime/build/app/outputs/flutter-apk/TaleTime*.apk