fix: manually set openssl config variables for aarch64 #39
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' | |
on: | |
push: | |
branches: [ '**' ] # To run on any branch | |
pull_request: | |
branches: [ '**' ] | |
workflow_dispatch: | |
jobs: | |
publish-tauri: | |
permissions: | |
contents: write | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- platform: 'macos-latest' # for Arm based macs (M1 and above). | |
args: '--target aarch64-apple-darwin' | |
- platform: 'macos-latest' # for Intel based macs. | |
args: '--target x86_64-apple-darwin' | |
- platform: 'ubuntu-22.04' # for Tauri v1 you could replace this with ubuntu-20.04. | |
args: '--target x86_64-unknown-linux-gnu' | |
- platform: 'ubuntu-22.04' # for Tauri v1 you could replace this with ubuntu-20.04. | |
args: '--target aarch64-unknown-linux-gnu' | |
runs-on: ${{ matrix.platform }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 'lts/*' | |
- name: Install pnpm | |
uses: pnpm/action-setup@v2 | |
with: | |
version: 8 | |
- name: Install Rust stable | |
uses: dtolnay/rust-toolchain@stable | |
with: | |
# Those targets are only used on macos runners so it's in an `if` to slightly speed up windows and linux builds. | |
targets: ${{ matrix.platform == 'macos-latest' && 'aarch64-apple-darwin,x86_64-apple-darwin' || '' }} | |
- name: Add aarch64-unknown-linux-gnu target | |
if: matrix.args == '--target aarch64-unknown-linux-gnu' | |
run: rustup target add aarch64-unknown-linux-gnu | |
- name: Setup cross-compilation for aarch64 | |
if: matrix.args == '--target aarch64-unknown-linux-gnu' | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y gcc-aarch64-linux-gnu g++-aarch64-linux-gnu | |
echo "CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=aarch64-linux-gnu-gcc" >> $GITHUB_ENV | |
echo "CC_aarch64_unknown_linux_gnu=aarch64-linux-gnu-gcc" >> $GITHUB_ENV | |
echo "CXX_aarch64_unknown_linux_gnu=aarch64-linux-gnu-g++" >> $GITHUB_ENV | |
echo "PKG_CONFIG_PATH=/usr/lib/aarch64-linux-gnu/pkgconfig" >> $GITHUB_ENV | |
echo "PKG_CONFIG_ALLOW_CROSS=1" >> $GITHUB_ENV | |
- name: Download and set up OpenSSL for cross-compilation | |
if: matrix.args == '--target aarch64-unknown-linux-gnu' | |
run: | | |
wget https://www.openssl.org/source/openssl-1.1.1k.tar.gz | |
tar -xzf openssl-1.1.1k.tar.gz | |
cd openssl-1.1.1k | |
./Configure linux-aarch64 --prefix=$HOME/openssl-aarch64 --cross-compile-prefix=aarch64-linux-gnu- | |
make -j$(nproc) | |
make install_sw | |
cd .. | |
echo "OPENSSL_DIR=$HOME/openssl-aarch64" >> $GITHUB_ENV | |
echo "OPENSSL_LIB_DIR=$HOME/openssl-aarch64/lib" >> $GITHUB_ENV | |
echo "OPENSSL_INCLUDE_DIR=$HOME/openssl-aarch64/include" >> $GITHUB_ENV | |
echo "PKG_CONFIG_PATH=$HOME/openssl-aarch64/lib/pkgconfig:$PKG_CONFIG_PATH" >> $GITHUB_ENV | |
echo "PKG_CONFIG_ALLOW_CROSS=1" >> $GITHUB_ENV | |
echo "PKG_CONFIG_SYSROOT_DIR=/" >> $GITHUB_ENV | |
echo "OPENSSL_STATIC=1" >> $GITHUB_ENV | |
- name: Install dependencies (ubuntu only) | |
if: matrix.platform == 'ubuntu-22.04' | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y libgtk-3-dev libwebkit2gtk-4.0-dev libappindicator3-dev librsvg2-dev patchelf pkg-config libssl-dev | |
# 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 frontend dependencies | |
run: pnpm install | |
- name: Build Tauri app (aarch64) | |
if: matrix.args == '--target aarch64-unknown-linux-gnu' | |
uses: tauri-apps/tauri-action@v0 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
OPENSSL_DIR: ${{ env.OPENSSL_DIR }} | |
OPENSSL_LIB_DIR: ${{ env.OPENSSL_LIB_DIR }} | |
OPENSSL_INCLUDE_DIR: ${{ env.OPENSSL_INCLUDE_DIR }} | |
PKG_CONFIG_PATH: ${{ env.PKG_CONFIG_PATH }} | |
PKG_CONFIG_ALLOW_CROSS: ${{ env.PKG_CONFIG_ALLOW_CROSS }} | |
PKG_CONFIG_SYSROOT_DIR: ${{ env.PKG_CONFIG_SYSROOT_DIR }} | |
OPENSSL_STATIC: ${{ env.OPENSSL_STATIC }} | |
with: | |
tagName: app-v__VERSION__ | |
releaseName: 'App v__VERSION__' | |
releaseBody: 'See the assets to download this version and install.' | |
releaseDraft: true | |
prerelease: false | |
args: ${{ matrix.args }} | |
- name: Build Tauri app (non-aarch64) | |
if: matrix.args != '--target aarch64-unknown-linux-gnu' | |
uses: tauri-apps/tauri-action@v0 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tagName: app-v__VERSION__ | |
releaseName: 'App v__VERSION__' | |
releaseBody: 'See the assets to download this version and install.' | |
releaseDraft: true | |
prerelease: false | |
args: ${{ matrix.args }} |