name: Release build
on:
push:
tags:
- "v0.*"
- "v1.*"
env:
CARGO_TERM_COLOR: always
jobs:
exm:
strategy:
fail-fast: true
matrix:
pair:
- target: armv7-unknown-linux-gnueabihf
os: ubuntu-latest
bin: exm
cross: true
- target: x86_64-unknown-linux-gnu
os: ubuntu-latest
bin: exm
cross: true
- target: x86_64-apple-darwin
os: macOS-11
bin: exm
cross: false
- target: aarch64-apple-darwin
os: macOS-11
bin: exm
cross: false
- target: x86_64-pc-windows-msvc
os: windows-latest
bin: exm.exe
cross: false
runs-on: ${{ matrix.pair.os }}
steps:
- uses: actions/checkout@v3
- uses: actions-rs/toolchain@v1.0.7
with:
toolchain: stable
target: ${{ matrix.pair.target }}
override: true
- name: Install master version of cross run: |
cargo install cross --git https://github.com/cross-rs/cross
- name: Install Protoc
uses: arduino/setup-protoc@v1
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- uses: actions-rs/cargo@v1.0.3
with:
use-cross: ${{ matrix.pair.cross }}
command: build
args: -p exm --profile production --target ${{ matrix.pair.target }}
- name: Create binary
run: |
mkdir archive
cp target/${{ matrix.pair.target }}/production/${{ matrix.pair.bin }} archive
cd archive/
tar -czf ../exm.${{ matrix.pair.target }}.tar.gz *
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.pair.target }}-artifact
path: exm.${{ matrix.pair.target }}.tar.gz
if-no-files-found: error
web_client:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- name: Setup Node
uses: actions/setup-node@v3.5.1
with:
node-version: 14.x
- name: Build client
run: |
cd $GITHUB_WORKSPACE/web
yarn install
yarn build
cd $GITHUB_WORKSPACE/web/dist
tar -czf $GITHUB_WORKSPACE/exomind-web.tar.gz *
- name: Upload build artifacts
uses: actions/upload-artifact@v3
with:
name: client-web-artifact
path: exomind-web.tar.gz
if-no-files-found: error
app_package:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions-rs/toolchain@v1.0.7
with:
toolchain: stable
profile: minimal
target: wasm32-wasi
- uses: Swatinem/rust-cache@v1
- name: Install Protoc
uses: arduino/setup-protoc@v1
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Download exo
run: |
wget https://github.com/appaquet/exocore/releases/download/v0.1.24/exo.x86_64-unknown-linux-gnu.tar.gz -O - | tar -zx
echo `pwd` >> $GITHUB_PATH
- name: Build app
run: |
cd $GITHUB_WORKSPACE
./app/tools/build.sh
- name: Build app package
run: |
mv exomind.zip exomind-app.zip
- name: Upload build artifacts
uses: actions/upload-artifact@v3
with:
name: app-package-artifact
path: exomind-app.zip
if-no-files-found: error
electron_app:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [macos-11, ubuntu-latest, windows-latest]
steps:
- uses: actions/checkout@v3
- name: Setup Node
uses: actions/setup-node@v3.5.1
with:
node-version: 14.x
- name: Build
shell: bash
run: |
cd web
yarn install --frozen-lockfile
yarn electron_dist
mkdir pkg
if [ "${{ matrix.os }}" == "macos-11" ]; then
mv dist/Exomind-*-arm64.dmg pkg/exomind-electron-macos-aarch64.dmg
mv dist/Exomind-*.dmg pkg/exomind-electron-macos-x86_64.dmg
elif [ "${{ matrix.os }}" == "ubuntu-latest" ]; then
cp dist/exomind-*_amd64.snap pkg/exomind-electron-linux.snap
elif [ "${{ matrix.os }}" == "windows-latest" ]; then
cp dist/Exomind*.exe pkg/exomind-electron-win.exe
else
echo "${{ matrix.os }} not supported"
exit 1
fi
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Upload build artifacts
uses: actions/upload-artifact@v3
with:
name: electron-app-artifact
path: web/pkg/*
if-no-files-found: error
release:
runs-on: ubuntu-latest
needs: [exm, web_client, app_package, electron_app]
steps:
- uses: actions/checkout@v3
- name: Download all artifacts
uses: actions/download-artifact@v3
with:
path: artifacts
- name: List artifacts
run: |
ls -R artifacts/**/*
- name: Create release with artifacts
run: |
set -x
assets=()
for asset in ./artifacts/*/*; do
assets+=("-a" "$asset")
done
TAG="${GITHUB_REF##*/}"
hub release create "${assets[@]}" --draft --message "$TAG" "$TAG"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}