2023-08-09 19:01:20 +08:00
|
|
|
name: Release Linux App
|
|
|
|
|
|
|
|
on:
|
|
|
|
release:
|
|
|
|
types: [ published ]
|
2024-02-26 10:28:26 +08:00
|
|
|
workflow_dispatch:
|
|
|
|
inputs:
|
|
|
|
tag:
|
|
|
|
description: 'Version tag'
|
|
|
|
required: true
|
|
|
|
default: '1.0.0'
|
2023-08-09 19:01:20 +08:00
|
|
|
|
|
|
|
jobs:
|
|
|
|
release:
|
|
|
|
name: Release Linux App
|
2024-03-01 10:15:15 +08:00
|
|
|
runs-on: ubuntu-22.04
|
2023-08-09 19:01:20 +08:00
|
|
|
strategy:
|
|
|
|
matrix:
|
|
|
|
platform:
|
|
|
|
- linux/amd64
|
2024-03-01 10:15:15 +08:00
|
|
|
|
2023-08-09 19:01:20 +08:00
|
|
|
steps:
|
|
|
|
- name: Checkout source code
|
|
|
|
uses: actions/checkout@v3
|
|
|
|
|
|
|
|
- name: Normalise platform tag
|
|
|
|
id: normalise_platform
|
|
|
|
shell: bash
|
|
|
|
run: |
|
|
|
|
tag=$(echo ${{ matrix.platform }} | sed -e 's/\//_/g')
|
|
|
|
echo "tag=$tag" >> "$GITHUB_OUTPUT"
|
|
|
|
|
2024-03-01 10:15:15 +08:00
|
|
|
- name: Normalise platform arch
|
|
|
|
id: normalise_platform_arch
|
|
|
|
run: |
|
|
|
|
if [ "${{ matrix.platform }}" == "linux/amd64" ]; then
|
|
|
|
echo "arch=x86_64" >> "$GITHUB_OUTPUT"
|
|
|
|
elif [ "${{ matrix.platform }}" == "linux/aarch64" ]; then
|
|
|
|
echo "arch=aarch64" >> "$GITHUB_OUTPUT"
|
|
|
|
fi
|
|
|
|
|
2023-08-09 19:01:20 +08:00
|
|
|
- name: Normalise version tag
|
|
|
|
id: normalise_version
|
|
|
|
shell: bash
|
|
|
|
run: |
|
2024-02-26 10:28:26 +08:00
|
|
|
if [ "${{ github.event.release.tag_name }}" == "" ]; then
|
|
|
|
version=$(echo ${{ github.event.inputs.tag }} | sed -e 's/v//g')
|
|
|
|
echo "version=$version" >> "$GITHUB_OUTPUT"
|
|
|
|
else
|
|
|
|
version=$(echo ${{ github.event.release.tag_name }} | sed -e 's/v//g')
|
|
|
|
echo "version=$version" >> "$GITHUB_OUTPUT"
|
|
|
|
fi
|
2023-08-09 19:01:20 +08:00
|
|
|
|
|
|
|
- name: Setup Go
|
|
|
|
uses: actions/setup-go@v4
|
|
|
|
with:
|
|
|
|
go-version: stable
|
|
|
|
|
|
|
|
- name: Install wails
|
|
|
|
shell: bash
|
|
|
|
run: go install github.com/wailsapp/wails/v2/cmd/wails@latest
|
|
|
|
|
|
|
|
- name: Install Ubuntu prerequisites
|
|
|
|
shell: bash
|
|
|
|
run: |
|
|
|
|
sudo apt-get update
|
2024-03-01 10:15:15 +08:00
|
|
|
sudo apt-get install -y libgtk-3-dev libwebkit2gtk-4.0-dev libfuse-dev libfuse2
|
2023-08-09 19:01:20 +08:00
|
|
|
|
|
|
|
- name: Setup Node
|
2023-08-16 16:52:02 +08:00
|
|
|
uses: actions/setup-node@v3
|
2023-08-09 19:01:20 +08:00
|
|
|
with:
|
2024-01-18 21:00:02 +08:00
|
|
|
node-version: 18
|
2023-08-09 19:01:20 +08:00
|
|
|
|
|
|
|
- name: Build frontend assets
|
|
|
|
shell: bash
|
|
|
|
run: |
|
2023-09-05 14:43:43 +08:00
|
|
|
npm install -g npm@9
|
2023-08-09 19:01:20 +08:00
|
|
|
jq '.info.productVersion = "${{ steps.normalise_version.outputs.version }}"' wails.json > tmp.json
|
|
|
|
mv tmp.json wails.json
|
2023-08-26 02:39:05 +08:00
|
|
|
cd frontend
|
|
|
|
jq '.version = "${{ steps.normalise_version.outputs.version }}"' package.json > tmp.json
|
|
|
|
mv tmp.json package.json
|
|
|
|
npm install
|
2023-08-09 19:01:20 +08:00
|
|
|
|
|
|
|
- name: Build wails app for Linux
|
|
|
|
shell: bash
|
2023-10-17 10:19:50 +08:00
|
|
|
run: |
|
|
|
|
CGO_ENABLED=1 wails build -platform ${{ matrix.platform }} \
|
2024-02-26 10:28:26 +08:00
|
|
|
-ldflags "-X main.version=v${{ steps.normalise_version.outputs.version }} -X main.gaMeasurementID=${{ secrets.GA_MEASUREMENT_ID }} -X main.gaSecretKey=${{ secrets.LINUX_GA_SECRET }}" \
|
2023-10-17 10:19:50 +08:00
|
|
|
-o tiny-rdm
|
2023-08-09 19:01:20 +08:00
|
|
|
|
|
|
|
- name: Setup control template
|
|
|
|
shell: bash
|
|
|
|
run: |
|
|
|
|
content=$(cat build/linux/tiny-rdm_0.0.0_amd64/DEBIAN/control)
|
|
|
|
content=$(echo "$content" | sed -e "s/{{.Name}}/$(jq -r '.name' wails.json)/g")
|
|
|
|
content=$(echo "$content" | sed -e "s/{{.Info.ProductVersion}}/$(jq -r '.info.productVersion' wails.json)/g")
|
|
|
|
content=$(echo "$content" | sed -e "s/{{.Author.Name}}/$(jq -r '.author.name' wails.json)/g")
|
|
|
|
content=$(echo "$content" | sed -e "s/{{.Author.Email}}/$(jq -r '.author.email' wails.json)/g")
|
|
|
|
content=$(echo "$content" | sed -e "s/{{.Info.Comments}}/$(jq -r '.info.comments' wails.json)/g")
|
|
|
|
echo $content
|
|
|
|
echo "$content" > build/linux/tiny-rdm_0.0.0_amd64/DEBIAN/control
|
|
|
|
|
|
|
|
- name: Setup app template
|
|
|
|
shell: bash
|
|
|
|
run: |
|
|
|
|
content=$(cat build/linux/tiny-rdm_0.0.0_amd64/usr/share/applications/tiny-rdm.desktop)
|
|
|
|
content=$(echo "$content" | sed -e "s/{{.Info.ProductName}}/$(jq -r '.info.productName' wails.json)/g")
|
|
|
|
content=$(echo "$content" | sed -e "s/{{.Info.Comments}}/$(jq -r '.info.comments' wails.json)/g")
|
|
|
|
echo $content
|
|
|
|
echo "$content" > build/linux/tiny-rdm_0.0.0_amd64/usr/share/applications/tiny-rdm.desktop
|
|
|
|
|
|
|
|
- name: Package up deb file
|
|
|
|
shell: bash
|
|
|
|
run: |
|
|
|
|
mv build/bin/tiny-rdm build/linux/tiny-rdm_0.0.0_amd64/usr/local/bin/
|
|
|
|
cd build/linux
|
|
|
|
mv tiny-rdm_0.0.0_amd64 "tiny-rdm_${{ steps.normalise_version.outputs.version }}_amd64"
|
|
|
|
sed -i 's/0.0.0/${{ steps.normalise_version.outputs.version }}/g' "tiny-rdm_${{ steps.normalise_version.outputs.version }}_amd64/DEBIAN/control"
|
2023-08-19 19:11:46 +08:00
|
|
|
dpkg-deb --build -Zxz "tiny-rdm_${{ steps.normalise_version.outputs.version }}_amd64"
|
2023-08-09 19:01:20 +08:00
|
|
|
|
2024-03-01 10:15:15 +08:00
|
|
|
- name: Package up appimage file
|
|
|
|
run: |
|
|
|
|
curl https://github.com/linuxdeploy/linuxdeploy/releases/download/1-alpha-20240109-1/linuxdeploy-${{ steps.normalise_platform_arch.outputs.arch }}.AppImage \
|
|
|
|
-o linuxdeploy \
|
|
|
|
-L
|
|
|
|
chmod u+x linuxdeploy
|
|
|
|
|
|
|
|
./linuxdeploy --appdir AppDir
|
|
|
|
|
|
|
|
pushd AppDir
|
|
|
|
# Copy WebKit files.
|
|
|
|
find /usr/lib* -name WebKitNetworkProcess -exec mkdir -p $(dirname '{}') \; -exec cp --parents '{}' "." \; || true
|
|
|
|
find /usr/lib* -name WebKitWebProcess -exec mkdir -p $(dirname '{}') \; -exec cp --parents '{}' "." \; || true
|
|
|
|
find /usr/lib* -name libwebkit2gtkinjectedbundle.so -exec mkdir -p $(dirname '{}') \; -exec cp --parents '{}' "." \; || true
|
|
|
|
popd
|
|
|
|
|
|
|
|
|
|
|
|
mkdir -p AppDir/usr/share/icons/hicolor/512x512/apps
|
|
|
|
build_dir="build/linux/tiny-rdm_${{ steps.normalise_version.outputs.version }}_amd64"
|
|
|
|
|
|
|
|
cp -r $build_dir/usr/share/icons/hicolor/512x512/apps/tiny-rdm.png AppDir/usr/share/icons/hicolor/512x512/apps/
|
|
|
|
cp $build_dir/usr/local/bin/tiny-rdm AppDir/usr/bin/
|
|
|
|
|
|
|
|
|
|
|
|
sed -i 's#/usr/local/bin/tiny-rdm#tiny-rdm#g' $build_dir/usr/share/applications/tiny-rdm.desktop
|
|
|
|
|
|
|
|
curl -o linuxdeploy-plugin-gtk.sh "https://raw.githubusercontent.com/tauri-apps/linuxdeploy-plugin-gtk/master/linuxdeploy-plugin-gtk.sh"
|
|
|
|
|
|
|
|
sed -i '/XDG_DATA_DIRS/a export WEBKIT_DISABLE_COMPOSITING_MODE=1' linuxdeploy-plugin-gtk.sh
|
|
|
|
chmod +x linuxdeploy-plugin-gtk.sh
|
|
|
|
|
|
|
|
curl -o AppDir/AppRun https://github.com/AppImage/AppImageKit/releases/download/continuous/AppRun-${{ steps.normalise_platform_arch.outputs.arch }} -L
|
|
|
|
|
|
|
|
./linuxdeploy --appdir AppDir \
|
|
|
|
--output=appimage \
|
|
|
|
--plugin=gtk \
|
|
|
|
-e $build_dir/usr/local/bin/tiny-rdm \
|
|
|
|
-d $build_dir/usr/share/applications/tiny-rdm.desktop
|
|
|
|
|
2024-02-22 00:10:48 +08:00
|
|
|
- name: Rename deb
|
|
|
|
working-directory: ./build/linux
|
|
|
|
run: mv "tiny-rdm_${{ steps.normalise_version.outputs.version }}_amd64.deb" "tiny-rdm_${{ steps.normalise_version.outputs.version }}_${{ steps.normalise_platform.outputs.tag }}.deb"
|
|
|
|
|
2024-03-01 10:15:15 +08:00
|
|
|
- name: Rename appimage
|
|
|
|
run: mv Tiny_RDM-${{ steps.normalise_platform_arch.outputs.arch }}.AppImage "tiny-rdm_${{ steps.normalise_version.outputs.version }}_${{ steps.normalise_platform.outputs.tag }}.AppImage"
|
|
|
|
|
2023-08-09 19:01:20 +08:00
|
|
|
- name: Upload release asset
|
2024-02-22 00:10:48 +08:00
|
|
|
uses: softprops/action-gh-release@v1
|
|
|
|
with:
|
2024-02-26 10:28:26 +08:00
|
|
|
tag_name: v${{ steps.normalise_version.outputs.version }}
|
2024-03-01 10:15:15 +08:00
|
|
|
files: |
|
|
|
|
./build/linux/tiny-rdm_${{ steps.normalise_version.outputs.version }}_${{ steps.normalise_platform.outputs.tag }}.deb
|
|
|
|
tiny-rdm_${{ steps.normalise_version.outputs.version }}_${{ steps.normalise_platform.outputs.tag }}.AppImage
|
2024-02-22 00:10:48 +08:00
|
|
|
token: ${{ secrets.GITHUB_TOKEN }}
|