Try using flutter_to_debian #3
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" |