publish-binaries #178
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
# Copyright 2019-2022 Tauri Programme within The Commons Conservancy | |
# SPDX-License-Identifier: Apache-2.0 | |
# SPDX-License-Identifier: MIT | |
name: publish binaries | |
env: | |
MACOSX_DEPLOYMENT_TARGET: '10.13' | |
on: | |
workflow_dispatch: | |
inputs: | |
releaseId: | |
description: 'Release Id' | |
required: true | |
type: string | |
repository_dispatch: | |
types: [publish-binaries] | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
build: | |
strategy: | |
fail-fast: false | |
matrix: | |
settings: | |
- host: macos-latest | |
target: x86_64-apple-darwin | |
- host: macos-latest | |
target: aarch64-apple-darwin | |
- host: windows-latest | |
target: x86_64-pc-windows-msvc | |
ext: .exe | |
- host: windows-latest | |
target: aarch64-pc-windows-msvc | |
ext: .exe | |
- host: windows-latest | |
target: i686-pc-windows-msvc | |
ext: .exe | |
- host: ubuntu-latest | |
target: x86_64-unknown-linux-gnu | |
- host: ubuntu-latest | |
target: x86_64-unknown-linux-musl | |
- host: ubuntu-latest | |
target: aarch64-unknown-linux-gnu | |
setup: | | |
sudo apt-get update | |
sudo apt-get install gcc-aarch64-linux-gnu -y | |
- host: ubuntu-latest | |
target: armv7-unknown-linux-gnueabihf | |
setup: | | |
sudo apt-get update | |
sudo apt-get install gcc-arm-linux-gnueabihf g++-arm-linux-gnueabihf -y | |
- host: ubuntu-latest | |
target: aarch64-unknown-linux-musl | |
setup: | | |
wget https://musl.cc/aarch64-linux-musl-cross.tgz | |
echo '::group::extracting' | |
tar -xvzf aarch64-linux-musl-cross.tgz | |
name: ${{ matrix.settings.target }} | |
runs-on: ${{ matrix.settings.host }} | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: dtolnay/rust-toolchain@stable | |
with: | |
targets: ${{ matrix.settings.target }} | |
- name: setup system dependencies | |
run: ${{ matrix.settings.setup }} | |
if: ${{ matrix.settings.setup }} | |
shell: bash | |
- run: cargo build --release --package create-tauri-app --target ${{ matrix.settings.target }} | |
if: ${{ matrix.settings.target != 'aarch64-unknown-linux-musl' }} | |
- run: | | |
export PATH="$PWD/aarch64-linux-musl-cross/bin:$PATH" | |
cargo build --release --package create-tauri-app --target ${{ matrix.settings.target }} | |
if: ${{ matrix.settings.target == 'aarch64-unknown-linux-musl' }} | |
- name: upload artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: "${{ matrix.settings.target }}" | |
path: target/${{ matrix.settings.target }}/release/cargo-create-tauri-app${{ matrix.settings.ext }} | |
if-no-files-found: error | |
publish: | |
needs: | |
- build | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: download all artifacts | |
uses: actions/download-artifact@v3 | |
with: | |
path: binaries | |
- run: ls -R | |
working-directory: binaries | |
- name: rename files | |
working-directory: binaries | |
shell: bash | |
run: | | |
find . -name 'cargo-create-tauri-app*' -print0 | while read -d '' file | |
do | |
parent="$(basename $(dirname ${file}))" | |
target="${file#./}" | |
target="${target/cargo-create-tauri-app/create-tauri-app-${parent}}" | |
target="${target/${parent}\//}" | |
mv $file $target | |
done | |
find . -type d -empty -delete | |
- run: ls -R | |
working-directory: binaries | |
- uses: xresloader/upload-to-github-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
release_id: "${{ github.event.client_payload.releaseId || inputs.releaseId }}" | |
file: "binaries/*;create-tauri-app.sh;create-tauri-app.ps1" | |
draft: false |