-
Notifications
You must be signed in to change notification settings - Fork 4
160 lines (136 loc) · 4.67 KB
/
build-linux.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
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
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
name: Build Linux
on:
workflow_call:
inputs:
version:
type: string
required: true
prefix:
type: string
required: true
arch: # "arm64" or "amd64"
type: string
required: true
update-suffix: # "x64" or "386"
type: string
required: true
dist-suffix: # "64-bit" or "32-bit"
type: string
required: true
jobs:
build-linux:
permissions:
contents: "read"
id-token: "write"
env:
version: ${{ inputs.version }}
prefix: ${{ inputs.prefix }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Granting private modules access
run: git config --global url."https://${{ secrets.GH_TOKEN }}:[email protected]/".insteadOf "https://github.com/"
- name: Repo access
run: |
mkdir /tmp/cache
echo "machine github.com login ${{ secrets.GH_TOKEN }} password x-oauth-basic" > /tmp/cache/.netrc
chmod 600 /tmp/cache/.netrc
- uses: ruby/setup-ruby@v1
with:
ruby-version: '3.3'
- name: Install dependencies
run: |
sudo apt-get update
bundle update --bundler
sudo apt-get install -y file build-essential pkg-config
sudo apt-get install -y libunwind-dev libstdc++-12-dev libgstreamer1.0-dev libgstreamer-plugins-base1.0-d cmake
sudo apt-get install -y libgtk-3-0 libblkid1 liblzma5
sudo apt-get install -y libpcap-dev libgtk-3-dev libayatana-appindicator3-dev ruby-dev
- uses: actions/setup-go@v4
with:
go-version-file: "go.mod"
- name: Build
env:
VERSION: ${{ inputs.version }}
run: |
make "linux-${{inputs.arch}}"
- uses: actions/setup-python@v4
with:
python-version: '3.11.3'
- name: Install s3cmd
run: pip install s3cmd
- name: Set s3cmd permissions
run: |
echo "[default]" > "$HOME/.s3cfg"
echo "access_key = ${{ secrets.AWS_ACCESS_KEY }}" >> "$HOME/.s3cfg"
echo "secret_key = ${{ secrets.AWS_SECRET_KEY }}" >> "$HOME/.s3cfg"
# Install Flutter
- uses: subosito/flutter-action@v2
with:
channel: "stable"
- run: flutter --version
- run: make ffigen
- name: Setup protoc
uses: arduino/setup-protoc@v2
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Activate protoc-gen-dart plugin
run: |
dart pub global activate protoc_plugin
- uses: seanmiddleditch/gha-setup-ninja@master
- run: touch app.env
- name: Build Flutter app
run: flutter build linux
- name: Build installer
env:
VERSION: ${{ inputs.version }}
run: |
ls build/linux
cp liblantern.so "build/linux/${{inputs.update-suffix}}/release/bundle"
dart pub global activate flutter_to_debian
mkdir -p debian/gui
echo "flutter_app:
command: lantern
arch: x64
parent: /usr/local/lib
nonInteractive: false
control:
Package: lantern
Version: ${{ inputs.version }}
Architecture: ${{ inputs.arch }}
Priority: optional
Depends:
Maintainer:
Description: Censorship circumvention tool" >> debian/debian.yaml
echo "[Desktop Entry]
Version=${{ inputs.version }}
Name=Lantern
GenericName=Lantern
Comment=Censorship circumvention tool
Terminal=false
Type=Application
Categories=Utility
Keywords=Flutter;share;files;" >> debian/gui/lantern.desktop
flutter_to_debian
ls debian/packages
- uses: actions/upload-artifact@v4
with:
name: linux-build
path: |
"lantern_${{inputs.version}}_${{inputs.arch}}.deb"
- name: Push binaries to s3
env:
VERSION: "${{ inputs.version }}"
dist_versionless: "${{inputs.prefix}}-${{inputs.dist-suffix}}.deb"
dist: "${{inputs.prefix}}-${{inputs.version}}-${{inputs.dist-suffix}}.deb"
update: "lantern_update_linux_${{inputs.arch}}-${{inputs.version}}.bz2"
dist_source: "lantern_${{inputs.version}}_${{inputs.arch}}.deb"
update_source: "lantern_update_linux_${{inputs.arch}}.bz2"
run: |
ls -l
mv ${{ env.dist_source }} ${{ env.dist }}
mv ${{ env.update_source }} ${{ env.update }}
shasum -a 256 ${{ env.dist }} | cut -d " " -f 1 > ${{ env.dist }}.sha256
shasum -a 256 ${{ env.update }} | cut -d " " -f 1 > ${{ env.update }}.sha256
ls -l
s3cmd put --acl-public ${{ env.dist }} ${{ env.update }} ${{ env.update }}.sha256 ${{ env.dist }}.sha256 "s3://lantern"