Publish tauric #12
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: Publish tauric | |
on: | |
workflow_dispatch: | |
inputs: | |
publish-pypi: | |
default: false | |
required: false | |
description: "Trigger publish-pypi after deply" | |
type: boolean | |
jobs: | |
build: | |
name: ${{ matrix.target }} | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- platform: "macos-latest" # macOS arm64 | |
args: "--target aarch64-apple-darwin" | |
build-dir: "tauric-osx-aarch64" | |
archive: "tar" | |
target: "aarch64-apple-darwin" | |
- platform: "macos-latest" # macOS x86-64 | |
args: "--target x86_64-apple-darwin" | |
build-dir: "tauric-osx-x86-64" | |
archive: "tar" | |
target: "x86_64-apple-darwin" | |
- platform: "ubuntu-22.04" # Linux x86_64 | |
args: "" | |
build-dir: "tauric-linux-x86-64" | |
archive: "tar" | |
target: "x86_64-unknown-linux-gnu" | |
- platform: "windows-latest" # Windows x86_64 | |
args: "--target x86_64-pc-windows-msvc" | |
build-dir: "tauric-win-x86-64" | |
archive: "zip" | |
target: "x86_64-pc-windows-msvc" | |
runs-on: ${{ matrix.platform }} | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: install dependencies (ubuntu only) | |
if: matrix.platform == 'ubuntu-22.04' # This must match the platform value defined above. | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y libwebkit2gtk-4.0-dev libwebkit2gtk-4.1-dev libappindicator3-dev librsvg2-dev patchelf | |
# webkitgtk 4.0 is for Tauri v1 - webkitgtk 4.1 is for Tauri v2. | |
# You can remove the one that doesn't apply to your app to speed up the workflow a bit. | |
- name: Install Rust stable | |
uses: dtolnay/rust-toolchain@stable | |
with: | |
targets: ${{ matrix.target }} | |
- name: Rust cache | |
uses: swatinem/rust-cache@v2 | |
- name: Set up build directory | |
run: mkdir -p ${{ matrix.build-dir }} | |
- name: Build tauric | |
run: cargo build -p tauric --release ${{ matrix.args }} | |
- name: Copy files | |
run: | | |
# Headers | |
cp tauric/tauri.h "${{ matrix.build-dir }}/" | |
# Unix | |
cp -f "target/${{ matrix.target }}/release/libtauric.a" "${{ matrix.build-dir }}/" || : | |
cp -f "target/${{ matrix.target }}/release/libtauric.so" "${{ matrix.build-dir }}/" || : | |
cp -f "target/${{ matrix.target }}/release/libtauric.dylib" "${{ matrix.build-dir }}/" || : | |
# Linux? | |
cp -f "target/release/libtauric.a" "${{ matrix.build-dir }}/" || : | |
cp -f "target/release/libtauric.so" "${{ matrix.build-dir }}/" || : | |
# Windows | |
cp -f "target/${{ matrix.target }}/release/tauric.lib" "${{ matrix.build-dir }}/" || : | |
cp -f "target/${{ matrix.target }}/release/tauric.dll" "${{ matrix.build-dir }}/" || : | |
shell: bash | |
- name: Create archive | |
run: | | |
if [[ "${{ matrix.archive }}" == "tar" ]]; then | |
tar -czvf ${{ matrix.build-dir }}.tar.gz ${{ matrix.build-dir }} | |
elif [[ "${{ matrix.archive }}" == "zip" ]]; then | |
7z a ${{ matrix.build-dir }}.zip ${{ matrix.build-dir }} | |
fi | |
shell: bash | |
- name: Uplaod to releases | |
run: | | |
latestTag=$(gh release view --json tagName --jq '.tagName') | |
gh release upload $latestTag ${{ matrix.build-dir }}.* --clobber | |
env: | |
GH_TOKEN: ${{ secrets.GH_TOKEN }} | |
shell: bash | |
publish-pypi: | |
name: Trigger publish-pypi | |
needs: build | |
if: inputs.publish-pypi == 'true' | |
runs-on: ubuntu-latest | |
steps: | |
- name: Trigger publish-pypi | |
run: gh workflow run publish-pypi.yml | |
env: | |
GH_TOKEN: ${{ secrets.GH_TOKEN }} |