Repository navigation
130 lines (114 loc) · 4.03 KB
/
Copy pathbuild-linux.yml
File metadata and controls
130 lines (114 loc) · 4.03 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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
name: Build Linux
on:
workflow_dispatch:
inputs:
ref:
description: 'Branch/Tag to build'
required: true
default: 'master'
generate_manifest:
description: 'Update flathub manifest'
type: boolean
default: false
workflow_call:
inputs:
ref:
required: true
type: string
generate_manifest:
type: boolean
default: true
secrets:
SSH_DEPLOY_KEY:
required: true
permissions:
contents: read
jobs:
# TODO: note that we currently only build for x64, as arm64 is not supported by
# subosito/flutter-action@v2 yet and we don't want to install flutter manually
# just for this workflow: https://github.com/subosito/flutter-action/issues/345
build_linux:
name: Build application - ${{ matrix.platform }}
runs-on: ${{ matrix.runner }}
outputs:
flutter_sdk_version: ${{ steps.flutter-version.outputs.flutter_sdk_version }}
strategy:
matrix:
include:
- platform: x64
runner: ubuntu-latest
# - platform: arm64
# runner: ubuntu-24.04-arm
steps:
- name: Checkout application
uses: actions/checkout@v7
with:
persist-credentials: false
ref: ${{ inputs.ref }}
- name: Read Flutter SDK version
id: flutter-version
run: |
flutter_sdk_version=$(grep 'flutter-version:' .github/actions/flutter-common/action.yml | awk '{print $2}')
echo "flutter_sdk_version=$flutter_sdk_version" >> "$GITHUB_OUTPUT"
- name: Common setup
uses: ./.github/actions/flutter-common
# https://github.com/actions/runner-images/blob/main/images/ubuntu/Ubuntu2404-Readme.md
- name: Build application for linux
run: |
sudo apt update
sudo apt install -y pkg-config libgtk-3-dev liblzma-dev libstdc++-12-dev libsecret-1-dev libjsoncpp-dev --no-install-recommends
flutter build linux --release
tar -zcvf linux-${{ matrix.platform }}.tar.gz build/linux/${{ matrix.platform }}/release/bundle
- uses: actions/upload-artifact@v7
with:
name: builds-linux
path: |
linux-${{ matrix.platform }}.tar.gz
generate_flathub_manifest:
runs-on: ubuntu-latest
name: Update flathub manifest
if: ${{ inputs.generate_manifest }}
# If the job fails just continue, this can be done manually later
continue-on-error: true
needs:
- build_linux
steps:
- name: Checkout application
uses: actions/checkout@v7
with:
persist-credentials: false
ref: ${{ inputs.ref }}
# flutpak resolves the tag to its commit
fetch-depth: 0
- name: Common setup
uses: ./.github/actions/flutter-common
- name: Setup flutpak
uses: o-murphy/flutpak/.github/actions/setup-flutpak@v0.8.7
- name: Generate manifest with flutpak
env:
REF: ${{ inputs.ref }}
FLUTTER_VERSION: ${{ needs.build_linux.outputs.flutter_sdk_version }}
run: flutpak generate --tag "$REF" --flutter "$FLUTTER_VERSION"
- name: Checkout flatpak-flathub repo
uses: actions/checkout@v7
with:
repository: wger-project/de.wger.flutter
ssh-key: ${{ secrets.SSH_DEPLOY_KEY }}
path: flathub
- name: Copy manifest to flathub repository
working-directory: flathub
run: |
# The SDK module carries the Flutter version in its name, don't keep old ones
rm -rf flutter-sdk-*.json patches
cp -r ../flatpak/generated/. .
- name: Push updated config to flathub repository
working-directory: flathub
env:
REF: ${{ inputs.ref }}
run: |
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git checkout -b "release-$REF"
git add -A
git commit -m "Update to $REF"
git push origin "release-$REF"