Skip to content

Commit 5a3e818

Browse files
chore: Added Automatic app builds. (#1433)
Co-authored-by: Anashuman Singh <anash.cheema@gmail.com>
1 parent e230935 commit 5a3e818

File tree

5 files changed

+245
-0
lines changed

5 files changed

+245
-0
lines changed

.github/actions/debian/action.yml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: "Debian Workflow"
2+
3+
inputs:
4+
VERSION_NAME:
5+
description: 'Version Name to be used for build'
6+
required: false
7+
default: '1.0.0'
8+
VERSION_CODE:
9+
description: 'Version Code to be used for build'
10+
required: true
11+
default: '1'
12+
13+
runs:
14+
using: "composite"
15+
steps:
16+
- name: Set up Flutter
17+
uses: subosito/flutter-action@v2
18+
with:
19+
cache: true
20+
flutter-version-file: pubspec.yaml
21+
22+
- name: Install Linux dependencies
23+
shell: bash
24+
run: |
25+
sudo apt-get update
26+
sudo apt-get install -y \
27+
libgtk-3-dev \
28+
liblzma-dev \
29+
clang \
30+
cmake \
31+
ninja-build \
32+
pkg-config \
33+
libglib2.0-dev \
34+
libblkid-dev \
35+
libgcrypt20-dev
36+
37+
- name: Build Linux (Debian) App
38+
shell: bash
39+
env:
40+
VERSION_NAME: ${{ inputs.VERSION_NAME }}
41+
VERSION_CODE: ${{ inputs.VERSION_CODE }}
42+
run: |
43+
flutter build linux --build-name $VERSION_NAME --build-number $VERSION_CODE

.github/actions/macos/action.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: "macOS Workflow"
2+
3+
inputs:
4+
VERSION_NAME:
5+
description: 'Version Name to be used for build'
6+
required: false
7+
default: '1.0.0'
8+
VERSION_CODE:
9+
description: 'Version Code to be used for build'
10+
required: true
11+
default: '1'
12+
13+
runs:
14+
using: "composite"
15+
steps:
16+
- name: Set up Flutter
17+
uses: subosito/flutter-action@v2
18+
with:
19+
cache: true
20+
flutter-version-file: pubspec.yaml
21+
22+
- name: Build macOS App
23+
shell: bash
24+
env:
25+
VERSION_NAME: ${{ inputs.VERSION_NAME }}
26+
VERSION_CODE: ${{ inputs.VERSION_CODE }}
27+
run: |
28+
flutter build macos --build-name $VERSION_NAME --build-number $VERSION_CODE

.github/actions/windows/action.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: "Windows Workflow"
2+
3+
inputs:
4+
VERSION_NAME:
5+
description: 'Version Name to be used for build'
6+
required: false
7+
default: '1.0.0'
8+
VERSION_CODE:
9+
description: 'Version Code to be used for build'
10+
required: true
11+
default: '1'
12+
13+
runs:
14+
using: "composite"
15+
steps:
16+
- name: Set up Flutter
17+
uses: subosito/flutter-action@v2
18+
with:
19+
cache: true
20+
flutter-version-file: pubspec.yaml
21+
22+
- name: Build Windows App
23+
shell: bash
24+
env:
25+
VERSION_NAME: ${{ inputs.VERSION_NAME }}
26+
VERSION_CODE: ${{ inputs.VERSION_CODE }}
27+
run: |
28+
flutter build windows --build-name $VERSION_NAME --build-number $VERSION_CODE

.github/workflows/pull_request.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,4 +105,34 @@ jobs:
105105
uses: ./.github/actions/screenshot-ipad
106106
with:
107107
IPAD_DEVICE_MODEL: ${{ env.IPAD_DEVICE_MODEL }}
108+
109+
macos:
110+
name: macOS Flutter Build
111+
needs: common
112+
runs-on: macos-latest
113+
steps:
114+
- uses: actions/checkout@v4
115+
116+
- name: macOS Workflow
117+
uses: ./.github/actions/macos
118+
119+
windows:
120+
name: Windows Flutter Build
121+
needs: common
122+
runs-on: windows-latest
123+
steps:
124+
- uses: actions/checkout@v4
125+
126+
- name: Windows Workflow
127+
uses: ./.github/actions/windows
128+
129+
debian:
130+
name: Debian Flutter Build
131+
needs: common
132+
runs-on: ubuntu-latest
133+
steps:
134+
- uses: actions/checkout@v4
135+
136+
- name: Debian Workflow
137+
uses: ./.github/actions/debian
108138

.github/workflows/push.yml

Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -269,3 +269,119 @@ jobs:
269269
uses: ./.github/actions/screenshot-ipad
270270
with:
271271
IPAD_DEVICE_MODEL: ${{ env.IPAD_DEVICE_MODEL }}
272+
273+
debian:
274+
name: Debian Flutter Build
275+
needs: common
276+
runs-on: ubuntu-latest
277+
steps:
278+
- uses: actions/checkout@v4
279+
280+
- name: Debian Workflow
281+
uses: ./.github/actions/debian
282+
with:
283+
VERSION_NAME: ${{ needs.common.outputs.VERSION_NAME }}
284+
VERSION_CODE: ${{ needs.common.outputs.VERSION_CODE }}
285+
286+
- name: Upload Debian Build
287+
uses: actions/upload-artifact@v4
288+
with:
289+
name: Debian Build
290+
path: build/linux/x64/release/bundle/
291+
292+
- name: Push Debian Build to app branch
293+
shell: bash
294+
run: |
295+
git config --global user.name "github-actions[bot]"
296+
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
297+
298+
git clone --branch=app https://${{ github.repository_owner }}:${{ github.token }}@github.com/${{ github.repository }} app
299+
cd app
300+
branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}
301+
cp -r ../build/linux/x64/release/bundle/* .
302+
git checkout --orphan temporary
303+
git add --all
304+
git commit -m "[Auto] Update Debian build from $branch ($(date +%Y-%m-%d.%H:%M:%S))"
305+
git branch -D app
306+
git branch -m app
307+
git push --force origin app
308+
309+
macos:
310+
name: macOS Flutter Build
311+
needs: common
312+
runs-on: macos-latest
313+
steps:
314+
- uses: actions/checkout@v4
315+
316+
- name: macOS Workflow
317+
uses: ./.github/actions/macos
318+
with:
319+
VERSION_NAME: ${{ needs.common.outputs.VERSION_NAME }}
320+
VERSION_CODE: ${{ needs.common.outputs.VERSION_CODE }}
321+
322+
- name: Upload macOS Build
323+
uses: actions/upload-artifact@v4
324+
with:
325+
name: macOS Build
326+
path: build/macos/Build/Products/Release/
327+
328+
- name: Push macOS Build to app branch
329+
shell: bash
330+
run: |
331+
git config --global user.name "github-actions[bot]"
332+
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
333+
334+
git clone --branch=app https://${{ github.repository_owner }}:${{ github.token }}@github.com/${{ github.repository }} app
335+
cd app
336+
branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}
337+
338+
# Copy all macOS build artifacts to root
339+
cp -r ../build/macos/Build/Products/Release/* .
340+
341+
git checkout --orphan temporary
342+
git add --all
343+
git commit -m "[Auto] Update macOS build from $branch ($(date +%Y-%m-%d.%H:%M:%S))"
344+
git branch -D app
345+
git branch -m app
346+
git push --force origin app
347+
348+
349+
windows:
350+
name: Windows Flutter Build
351+
needs: common
352+
runs-on: windows-latest
353+
steps:
354+
- uses: actions/checkout@v4
355+
356+
- name: Windows Workflow
357+
uses: ./.github/actions/windows
358+
with:
359+
VERSION_NAME: ${{ needs.common.outputs.VERSION_NAME }}
360+
VERSION_CODE: ${{ needs.common.outputs.VERSION_CODE }}
361+
362+
- name: Upload Windows Build
363+
uses: actions/upload-artifact@v4
364+
with:
365+
name: Windows Build
366+
path: build/windows/x64/runner/Release/
367+
368+
- name: Push Windows Build to app branch
369+
shell: bash
370+
run: |
371+
git config --global user.name "github-actions[bot]"
372+
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
373+
374+
git clone --branch=app https://${{ github.repository_owner }}:${{ github.token }}@github.com/${{ github.repository }} app
375+
cd app
376+
branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}
377+
378+
# Copy all Windows build artifacts to root
379+
cp -r ../build/windows/x64/runner/Release/* .
380+
381+
git checkout --orphan temporary
382+
git add --all
383+
git commit -m "[Auto] Update Windows build from $branch ($(date +%Y-%m-%d.%H:%M:%S))"
384+
git branch -D app
385+
git branch -m app
386+
git push --force origin app
387+

0 commit comments

Comments
 (0)