136 lines
4.5 KiB
YAML
136 lines
4.5 KiB
YAML
name: Release
|
|
|
|
on:
|
|
release:
|
|
types: [published]
|
|
workflow_dispatch:
|
|
|
|
jobs:
|
|
build-flatpak:
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
contents: write
|
|
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Install flatpak and flatpak-builder
|
|
run: |
|
|
sudo apt-get update -q
|
|
sudo apt-get install -y flatpak flatpak-builder
|
|
|
|
- name: Add Flathub remote
|
|
run: |
|
|
flatpak remote-add --user --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
|
|
|
|
- name: Install runtimes
|
|
run: |
|
|
flatpak install -y --user \
|
|
org.freedesktop.Platform//24.08 \
|
|
org.freedesktop.Sdk//24.08 \
|
|
org.freedesktop.Sdk.Extension.rust-stable//24.08
|
|
|
|
- name: Generate cargo-sources.json
|
|
run: |
|
|
pip3 install tomlkit aiohttp
|
|
git clone --depth=1 https://github.com/flatpak/flatpak-builder-tools.git /tmp/flatpak-builder-tools
|
|
python3 /tmp/flatpak-builder-tools/cargo/flatpak-cargo-generator.py \
|
|
Cargo.lock -o flatpak/cargo-sources.json
|
|
|
|
- name: Build Flatpak
|
|
run: |
|
|
flatpak-builder --force-clean --user --repo=repo build-dir \
|
|
flatpak/io.github.HakanSeven12.H7CAD.ci.yml
|
|
|
|
- name: Create bundle
|
|
run: |
|
|
flatpak build-bundle repo H7CAD.flatpak io.github.HakanSeven12.H7CAD
|
|
|
|
- name: Upload bundle to release
|
|
if: github.event_name == 'release'
|
|
env:
|
|
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
run: |
|
|
mv H7CAD.flatpak H7CAD-${{ github.ref_name }}-linux-x86_64.flatpak
|
|
gh release upload ${{ github.ref_name }} H7CAD-${{ github.ref_name }}-linux-x86_64.flatpak --clobber --repo ${{ github.repository }}
|
|
|
|
build-appimage:
|
|
runs-on: ubuntu-22.04
|
|
permissions:
|
|
contents: write
|
|
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Install Rust
|
|
uses: dtolnay/rust-toolchain@stable
|
|
|
|
- name: Install dependencies
|
|
run: |
|
|
sudo apt-get update -q
|
|
sudo apt-get install -y \
|
|
libgl1-mesa-dev libx11-dev libxcursor-dev libxi-dev libxrandr-dev \
|
|
libxkbcommon-dev libwayland-dev libfontconfig1-dev libfreetype6-dev \
|
|
librsvg2-bin fuse libfuse2
|
|
|
|
- name: Build
|
|
run: cargo build --release
|
|
|
|
- name: Prepare AppDir
|
|
run: |
|
|
mkdir -p AppDir/usr/bin
|
|
mkdir -p AppDir/usr/share/applications
|
|
mkdir -p AppDir/usr/share/icons/hicolor/256x256/apps
|
|
cp target/release/H7CAD AppDir/usr/bin/H7CAD
|
|
cp flatpak/io.github.HakanSeven12.H7CAD.desktop AppDir/usr/share/applications/
|
|
rsvg-convert -w 256 -h 256 assets/logo.svg \
|
|
-o AppDir/usr/share/icons/hicolor/256x256/apps/io.github.HakanSeven12.H7CAD.png
|
|
|
|
- name: Download linuxdeploy
|
|
run: |
|
|
wget -q https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-x86_64.AppImage
|
|
chmod +x linuxdeploy-x86_64.AppImage
|
|
|
|
- name: Build AppImage
|
|
env:
|
|
APPIMAGE_EXTRACT_AND_RUN: 1
|
|
run: |
|
|
./linuxdeploy-x86_64.AppImage \
|
|
--appdir AppDir \
|
|
--desktop-file flatpak/io.github.HakanSeven12.H7CAD.desktop \
|
|
--icon-file AppDir/usr/share/icons/hicolor/256x256/apps/io.github.HakanSeven12.H7CAD.png \
|
|
--output appimage
|
|
mv H7CAD*.AppImage H7CAD.AppImage
|
|
|
|
- name: Upload AppImage to release
|
|
if: github.event_name == 'release'
|
|
env:
|
|
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
run: |
|
|
mv H7CAD.AppImage H7CAD-${{ github.ref_name }}-linux-x86_64.AppImage
|
|
gh release upload ${{ github.ref_name }} H7CAD-${{ github.ref_name }}-linux-x86_64.AppImage --clobber --repo ${{ github.repository }}
|
|
|
|
build-windows:
|
|
runs-on: windows-latest
|
|
permissions:
|
|
contents: write
|
|
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Install Rust
|
|
uses: dtolnay/rust-toolchain@stable
|
|
|
|
- name: Build
|
|
run: cargo build --release
|
|
|
|
- name: Upload exe to release
|
|
if: github.event_name == 'release'
|
|
env:
|
|
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
run: |
|
|
mv target/release/H7CAD.exe H7CAD-${{ github.ref_name }}-windows-x86_64.exe
|
|
gh release upload ${{ github.ref_name }} H7CAD-${{ github.ref_name }}-windows-x86_64.exe --clobber --repo ${{ github.repository }}
|