attempt appimage generation #59
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: Dioxus Builds | |
on: [push, pull_request, workflow_dispatch] | |
permissions: | |
contents: write | |
env: | |
RUSTFLAGS: -D warnings | |
RUSTDOCFLAGS: -D warnings | |
PKG_CONFIG_PATH: /usr/lib/x86_64-linux-gnu/pkgconfig | |
concurrency: | |
group: ci-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
fmt: | |
name: Rustfmt | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: dtolnay/rust-toolchain@stable | |
with: | |
components: rustfmt | |
- uses: actions-rs/cargo@v1 | |
with: | |
command: fmt | |
args: --all -- --check | |
dioxus_build: | |
name: Dioxus Build | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- os: ubuntu-latest | |
TARGET: web | |
- os: ubuntu-latest | |
TARGET: desktop | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: dtolnay/rust-toolchain@stable | |
with: | |
targets: wasm32-unknown-unknown | |
- name: Install dependencies (Ubuntu) | |
if: matrix.os == 'ubuntu-latest' | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y \ | |
libgtk-3-dev \ | |
libwebkit2gtk-4.0-dev \ | |
libayatana-appindicator3-dev \ | |
librsvg2-dev \ | |
libjavascriptcoregtk-4.0-dev \ | |
libsoup2.4-dev \ | |
libglib2.0-dev \ | |
libatk1.0-dev \ | |
libpango1.0-dev \ | |
libcairo2-dev \ | |
libgdk-pixbuf2.0-dev \ | |
libwayland-dev \ | |
libxkbcommon-dev \ | |
libjavascriptcoregtk-4.1-dev \ | |
libsoup-3.0-dev \ | |
libwebkit2gtk-4.1-dev \ | |
libxdo-dev | |
- name: Install Dioxus CLI | |
run: cargo install dioxus-cli | |
- name: Build for ${{ matrix.TARGET }} | |
run: dx build --release --platform ${{ matrix.TARGET }} | |
- name: Rename and package | |
shell: bash | |
run: | | |
if [ "${{ matrix.TARGET }}" = "web" ]; then | |
tar -czvf mylife-web.tar.gz dist | |
elif [ "${{ matrix.OS }}" = "windows-latest" ]; then | |
mv target/release/mylife.exe mylife-windows.exe | |
elif [ "${{ matrix.OS }}" = "macos-latest" ]; then | |
mv target/release/mylife mylife-macos | |
else | |
mv target/release/mylife mylife-linux | |
fi | |
- name: Create AppImage (Linux) | |
if: matrix.os == 'ubuntu-latest' && matrix.TARGET == 'desktop' | |
run: | | |
sudo apt-get install -y libfuse2 | |
wget -O linuxdeploy-x86_64.AppImage https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-x86_64.AppImage | |
chmod +x linuxdeploy-x86_64.AppImage | |
mkdir -p AppDir/usr/bin AppDir/usr/share/applications AppDir/usr/share/icons/hicolor/256x256/apps | |
cp mylife-linux AppDir/usr/bin/mylife | |
cp icon-256.png AppDir/usr/share/icons/hicolor/256x256/apps/mylife.png | |
cat > AppDir/usr/share/applications/mylife.desktop << EOF | |
[Desktop Entry] | |
Name=MyLife | |
Exec=mylife | |
Icon=mylife | |
Type=Application | |
Categories=Utility; | |
EOF | |
./linuxdeploy-x86_64.AppImage --appdir AppDir --desktop-file=AppDir/usr/share/applications/mylife.desktop --icon-file=AppDir/usr/share/icons/hicolor/256x256/apps/mylife.png --output appimage | |
mv MyLife*.AppImage mylife-linux.AppImage | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: mylife-${{ matrix.TARGET }}-${{ matrix.os }} | |
path: | | |
mylife-* | |
*.tar.gz | |
*.AppImage | |
- uses: svenstaro/upload-release-action@v2 | |
if: ${{ github.event_name == 'push' }} | |
with: | |
repo_token: ${{ secrets.GITHUB_TOKEN }} | |
file: mylife-* | |
file_glob: true | |
tag: ${{ github.ref }} | |
prerelease: ${{ !startsWith(github.ref, 'refs/tags/') }} | |
overwrite: true |