Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
194 changes: 194 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,194 @@
name: Release and Deploy

on:
push:
branches:
- master

env:
APP_NAME: rust_multibackend_app
CARGO_TERM_COLOR: always

jobs:
build-binaries:
name: Build Binaries
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
use-cross: false
ext: ""
- os: ubuntu-latest
target: aarch64-unknown-linux-gnu
use-cross: true
ext: ""
- os: ubuntu-latest
target: riscv64gc-unknown-linux-gnu
use-cross: true
ext: ""
- os: macos-latest
target: x86_64-apple-darwin
use-cross: false
ext: ""
- os: macos-latest
target: aarch64-apple-darwin
use-cross: false
ext: ""
- os: windows-latest
target: x86_64-pc-windows-msvc
use-cross: false
ext: ".exe"

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Install Rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
target: ${{ matrix.target }}
override: true
profile: minimal

- name: Install cross
if: matrix.use-cross == true
run: cargo install cross --git https://github.com/cross-rs/cross --branch main

- name: Build TUI
uses: actions-rs/cargo@v1
with:
use-cross: ${{ matrix.use-cross }}
command: build
args: --release --no-default-features --features tui --target ${{ matrix.target }}

- name: Rename TUI artifact
shell: bash
run: |
mv target/${{ matrix.target }}/release/${{ env.APP_NAME }}${{ matrix.ext }} ./tui-artifact${{ matrix.ext }}

- name: Build GUI
uses: actions-rs/cargo@v1
with:
use-cross: ${{ matrix.use-cross }}
command: build
args: --release --no-default-features --features gui --target ${{ matrix.target }}

- name: Rename GUI artifact
shell: bash
run: |
mv target/${{ matrix.target }}/release/${{ env.APP_NAME }}${{ matrix.ext }} ./gui-artifact${{ matrix.ext }}

- name: Upload Binaries
uses: actions/upload-artifact@v4
with:
name: binaries-${{ matrix.target }}
path: |
./tui-artifact${{ matrix.ext }}
./gui-artifact${{ matrix.ext }}

build-uefi:
name: Build UEFI
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
target: x86_64-unknown-uefi
override: true
components: rust-src
- name: Build UEFI binary
run: cargo build --release --target x86_64-unknown-uefi --no-default-features --features uefi
- name: Upload UEFI artifact
uses: actions/upload-artifact@v4
with:
name: uefi-binary
path: target/x86_64-unknown-uefi/release/${{ env.APP_NAME }}.efi

build-wasm:
name: Build WASM
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
- name: Install wasm-pack
run: cargo install wasm-pack
- name: Build WASM package
run: wasm-pack build --target web -- --no-default-features --features wasm
- name: Prepare Pages directory
run: |
mkdir dist
cp pkg/rust_multibackend_app_bg.wasm dist/
cp pkg/rust_multibackend_app.js dist/
cp index.html dist/
sed -i 's|./pkg/rust_multibackend_app.js|./rust_multibackend_app.js|' dist/index.html
- name: Upload WASM artifact
uses: actions/upload-artifact@v4
with:
name: pages-artifact
path: dist

release:
name: Create Release
needs: [build-binaries, build-uefi]
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Get release version
id: get_version
run: echo "version=v$(date +'%Y%m%d.%H%M%S')" >> $GITHUB_ENV
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
- name: Organize files
run: |
mkdir release-files
find artifacts -type f -name "tui-artifact*" | while read -r file; do
target_name=$(basename "$(dirname "$file")" | sed 's/binaries-//')
ext=$(echo "$file" | grep -oE '\.[^.]*$|' | sed 's/\.//')
mv "$file" "release-files/${{ env.APP_NAME }}-tui-${target_name}${ext}"
done
find artifacts -type f -name "gui-artifact*" | while read -r file; do
target_name=$(basename "$(dirname "$file")" | sed 's/binaries-//')
ext=$(echo "$file" | grep -oE '\.[^.]*$|' | sed 's/\.//')
mv "$file" "release-files/${{ env.APP_NAME }}-gui-${target_name}${ext}"
done
mv artifacts/uefi-binary/${{ env.APP_NAME }}.efi release-files/
- name: Create Release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ env.version }}
name: Release ${{ env.version }}
files: release-files/*
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

deploy-pages:
name: Deploy to GitHub Pages
needs: build-wasm
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Download WASM artifact
uses: actions/download-artifact@v4
with:
name: pages-artifact
path: ./dist
- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./dist
force_orphan: true
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/target
/pkg
/src.txt
/src.txt
*/*.EFI
4 changes: 2 additions & 2 deletions readme.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Rust Multi-Backend App (GUI / TUI / WASM)
# Typing Multi-Platform app (GUI / EFI / TUI / WASM)

RustでGUI、TUI、WASMの3つのバックエンドを持つテキスト入力アプリケーションのサンプルです
RustでGUI、EFI、TUI、WASMの4つのバックエンドを持つテキスト入力アプリケーションのサンプルです

## 実行方法

Expand Down
Loading