Files
picoforge/.github/workflows/release.yml
T

193 lines
6.7 KiB
YAML

name: "publish-stable"
on:
push:
branches:
- release
workflow_dispatch:
workflow_run:
workflows: ["CI"]
branches:
- release
types:
- completed
jobs:
build-and-release:
if: github.event_name != 'workflow_run' || github.event.workflow_run.conclusion == 'success'
permissions:
contents: write
issues: write
pull-requests: write
strategy:
fail-fast: false
matrix:
include:
- platform: "macos-latest"
args: "--target aarch64-apple-darwin"
build_type: "standard"
- platform: "macos-latest"
args: "--target x86_64-apple-darwin"
build_type: "standard"
- platform: "ubuntu-22.04"
args: ""
build_type: "standard"
- platform: "ubuntu-latest"
args: ""
build_type: "flatpak"
- platform: "ubuntu-24.04-arm"
args: ""
build_type: "standard"
- platform: "ubuntu-24.04-arm"
args: ""
build_type: "flatpak"
- platform: "windows-latest"
args: "--target x86_64-pc-windows-msvc"
build_type: "standard"
- platform: "windows-latest"
args: "--target i686-pc-windows-msvc"
build_type: "standard"
- platform: "windows-latest"
args: "--target aarch64-pc-windows-msvc"
build_type: "standard"
runs-on: ${{ matrix.platform }}
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
- name: install Rust stable
if: matrix.build_type == 'standard'
uses: dtolnay/rust-toolchain@stable
with:
targets: >
${{ matrix.platform == 'macos-latest' && 'aarch64-apple-darwin,x86_64-apple-darwin' ||
matrix.platform == 'windows-latest' && 'x86_64-pc-windows-msvc,i686-pc-windows-msvc,aarch64-pc-windows-msvc' || '' }}
- name: Cache Cargo registry and target
if: matrix.build_type == 'standard'
uses: Swatinem/rust-cache@v2
with:
key: ${{ matrix.platform }}-${{ matrix.args }}
- name: install dependencies (ubuntu only)
if: matrix.platform == 'ubuntu-22.04' || matrix.platform == 'ubuntu-24.04-arm'
run: |
sudo apt-get update
sudo apt install -y \
build-essential \
pkg-config \
libssl-dev \
libpcsclite-dev \
libudev-dev \
libvulkan-dev \
vulkan-tools \
libwayland-dev \
wayland-protocols \
libxkbcommon-dev \
libxcb1-dev \
libxkbcommon-x11-dev \
libfontconfig1-dev \
libasound2-dev \
libdbus-1-dev \
file \
desktop-file-utils \
libx11-dev \
libxcb-shape0-dev \
libxcb-xfixes0-dev libusb-1.0-0-dev podman patchelf librsvg2-dev libappindicator3-dev libwebkit2gtk-4.1-dev
- name: install dependencies (ubuntu-arm64 only)
if: matrix.platform == 'ubuntu-24.04-arm'
run: |
sudo apt-get install xdg-utils
- name: Extract version from Cargo.toml
id: get_version
shell: bash
run: |
cargo_file="Cargo.toml"
version=$(grep -m 1 '^version' "$cargo_file" | sed -E 's/.*"([0-9]+\.[0-9]+\.[0-9]+)".*/\1/')
echo "Version found: $version"
echo "version=$version" >> $GITHUB_ENV
- name: install cargo-packager
if: matrix.build_type == 'standard'
uses: taiki-e/install-action@v2
with:
tool: cargo-packager
- name: Build Binary
if: matrix.build_type == 'standard'
run: cargo build --release ${{ matrix.args }}
- name: Build and Package
if: matrix.platform != 'ubuntu-22.04' && matrix.platform != 'ubuntu-24.04-arm' && matrix.build_type == 'standard'
run: cargo packager --release ${{ matrix.args }}
- name: Build and Package (Linux)
if: (matrix.platform == 'ubuntu-22.04' || matrix.platform == 'ubuntu-24.04-arm') && matrix.build_type == 'standard'
run: cargo packager --release --formats deb,pacman
- name: Build AppImage
if: (matrix.platform == 'ubuntu-22.04' || matrix.platform == 'ubuntu-24.04-arm') && matrix.build_type == 'standard'
run: |
chmod +x .github/scripts/build_appimage.sh
./.github/scripts/build_appimage.sh
- name: Build Flatpak
if: matrix.build_type == 'flatpak'
run: |
sudo apt-get update
sudo apt-get install -y flatpak flatpak-builder appstream
chmod +x .github/scripts/build_flatpak.sh
./.github/scripts/build_flatpak.sh ${{ matrix.platform }}
- name: Upload Release Assets
uses: softprops/action-gh-release@v2
with:
tag_name: v${{ env.version }}
name: "PicoForge-v${{ env.version }}"
body: |
> [!WARNING]
> This is a Beta release and thus can have some bugs, report them using github issues.
#### Check the Installation guide for the Application on the wiki: https://github.com/librekeys/picoforge/wiki/Installation
prerelease: false
files: |
*.flatpak
target/release/*.deb
target/release/*.appimage
target/release/*.AppImage
target/release/*.tar.gz
target/release/*.msi
target/release/*.dmg
target/release/*.app
target/x86_64-apple-darwin/release/*.dmg
target/aarch64-apple-darwin/release/*.dmg
target/x86_64-apple-darwin/release/*.app
target/aarch64-apple-darwin/release/*.app
target/x86_64-pc-windows-msvc/release/*.msi
target/x86_64-pc-windows-msvc/release/*-setup.exe
target/i686-pc-windows-msvc/release/*.msi
target/i686-pc-windows-msvc/release/*-setup.exe
target/aarch64-pc-windows-msvc/release/*.msi
target/aarch64-pc-windows-msvc/release/*-setup.exe
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Sync Spec Version & Tag
if: matrix.platform == 'ubuntu-22.04' && matrix.build_type == 'standard'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
chmod +x .github/scripts/sync_spec_version.sh
podman run --rm \
--security-opt label=disable \
-v "$PWD":/workspace \
-w /workspace \
-e GITHUB_TOKEN=$GITHUB_TOKEN \
-e GITHUB_REPOSITORY=$GITHUB_REPOSITORY \
fedora:latest \
/workspace/.github/scripts/sync_spec_version.sh