279 lines
8.6 KiB
YAML
279 lines
8.6 KiB
YAML
name: releases
|
|
|
|
on:
|
|
push:
|
|
tags:
|
|
- v*
|
|
|
|
jobs:
|
|
build-bin-cross:
|
|
runs-on: ubuntu-latest
|
|
strategy:
|
|
matrix:
|
|
target:
|
|
- mips-unknown-linux-musl
|
|
# - mipsel-unknown-linux-musl
|
|
- x86_64-unknown-linux-musl
|
|
# - i686-unknown-linux-musl
|
|
- aarch64-unknown-linux-musl
|
|
# - arm-unknown-linux-musleabi
|
|
# - armv7-unknown-linux-musleabihf
|
|
- x86_64-pc-windows-gnu
|
|
steps:
|
|
- name: checkout
|
|
uses: actions/checkout@v2
|
|
with:
|
|
submodules: true
|
|
|
|
- name: install rust toolchain
|
|
uses: hecrj/setup-rust-action@v1
|
|
with:
|
|
rust-version: nightly
|
|
|
|
- name: install deps
|
|
run: |
|
|
sudo apt update && sudo apt install llvm-dev libclang-dev clang libssl-dev pkg-config protobuf-compiler make -y
|
|
|
|
- name: install cross
|
|
run: |
|
|
cargo install cross
|
|
|
|
- name: build
|
|
run: |
|
|
export CFG_COMMIT_HASH=`git log --pretty=format:'%h' -n 1`
|
|
export CFG_COMMIT_DATE=`git log --format="%ci" -n 1`
|
|
./misc/build_cross.sh ${{ matrix.target }}
|
|
|
|
- name: rename and compress artifacts
|
|
if: ${{ matrix.target == 'x86_64-pc-windows-gnu' }}
|
|
run: |
|
|
mv target/${{ matrix.target }}/release/leaf.exe leaf-${{ matrix.target }}.exe
|
|
|
|
- name: rename and compress artifacts
|
|
if: ${{ matrix.target != 'x86_64-pc-windows-gnu' }}
|
|
run: |
|
|
mv target/${{ matrix.target }}/release/leaf leaf-${{ matrix.target }}
|
|
|
|
- name: upload assets
|
|
if: ${{ matrix.target == 'x86_64-pc-windows-gnu' }}
|
|
uses: actions/upload-artifact@v2
|
|
with:
|
|
name: leaf-${{ matrix.target }}.exe
|
|
path: leaf-${{ matrix.target }}.exe
|
|
|
|
- name: upload assets
|
|
if: ${{ matrix.target != 'x86_64-pc-windows-gnu' }}
|
|
uses: actions/upload-artifact@v2
|
|
with:
|
|
name: leaf-${{ matrix.target }}
|
|
path: leaf-${{ matrix.target }}
|
|
|
|
build-bin-local:
|
|
strategy:
|
|
matrix:
|
|
os: [macos-latest]
|
|
include:
|
|
- os: macos-latest
|
|
target: x86_64-apple-darwin
|
|
runs-on: ${{ matrix.os }}
|
|
steps:
|
|
- name: checkout
|
|
uses: actions/checkout@v2
|
|
with:
|
|
submodules: true
|
|
|
|
- name: install rust toolchain
|
|
uses: hecrj/setup-rust-action@v1
|
|
with:
|
|
rust-version: nightly
|
|
|
|
- name: install llvm
|
|
if: ${{ matrix.os == 'macos-latest' }}
|
|
run: |
|
|
brew update && brew install llvm protobuf
|
|
|
|
- name: build
|
|
run: |
|
|
export CFG_COMMIT_HASH=`git log --pretty=format:'%h' -n 1`
|
|
export CFG_COMMIT_DATE=`git log --format="%ci" -n 1`
|
|
cargo build --release --target ${{ matrix.target }} -p leaf-bin
|
|
|
|
- name: rename and compress artifacts
|
|
run: |
|
|
mv target/${{ matrix.target }}/release/leaf leaf-${{ matrix.target }}
|
|
|
|
- name: upload assets
|
|
uses: actions/upload-artifact@v2
|
|
with:
|
|
name: leaf-${{ matrix.target }}
|
|
path: leaf-${{ matrix.target }}
|
|
|
|
# build-lib-ios:
|
|
# runs-on: macos-latest
|
|
# steps:
|
|
# - name: checkout
|
|
# uses: actions/checkout@v2
|
|
# with:
|
|
# submodules: true
|
|
#
|
|
# - name: install rust
|
|
# uses: hecrj/setup-rust-action@v1
|
|
# with:
|
|
# rust-version: nightly
|
|
#
|
|
# - name: install toolchain
|
|
# run: |
|
|
# rustup target add aarch64-apple-ios
|
|
# cargo install cargo-lipo
|
|
# cargo install cbindgen
|
|
# brew update && brew install llvm unzip protobuf
|
|
#
|
|
# - name: build
|
|
# run: |
|
|
# make ios
|
|
#
|
|
# - name: zip artifacts
|
|
# run: |
|
|
# mv target/universal/release/libleaf.a .
|
|
# mv target/universal/release/leaf.h .
|
|
# zip libleaf-ios.zip leaf.h libleaf.a
|
|
#
|
|
# - name: upload assets
|
|
# uses: actions/upload-artifact@v2
|
|
# with:
|
|
# name: libleaf-ios.zip
|
|
# path: libleaf-ios.zip
|
|
|
|
create-release:
|
|
needs: [build-bin-cross, build-bin-local]
|
|
runs-on: macos-latest
|
|
steps:
|
|
- name: checkout
|
|
uses: actions/checkout@v2
|
|
with:
|
|
submodules: true
|
|
|
|
- name: Create Release
|
|
id: create_release
|
|
uses: actions/create-release@v1
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
with:
|
|
tag_name: ${{ github.ref }}
|
|
release_name: Release ${{ github.ref }}
|
|
draft: false
|
|
prerelease: false
|
|
|
|
- name: create upload url file
|
|
run: |
|
|
echo -n "${{ steps.create_release.outputs.upload_url }}" > upload_url.txt
|
|
|
|
- name: persist upload url
|
|
uses: actions/upload-artifact@v2
|
|
with:
|
|
name: upload_url.txt
|
|
path: ./upload_url.txt
|
|
|
|
release-bin:
|
|
needs: [create-release]
|
|
runs-on: macos-latest
|
|
strategy:
|
|
matrix:
|
|
target:
|
|
- x86_64-apple-darwin
|
|
- mips-unknown-linux-musl
|
|
# - mipsel-unknown-linux-musl
|
|
- x86_64-unknown-linux-musl
|
|
# - i686-unknown-linux-musl
|
|
- aarch64-unknown-linux-musl
|
|
# - arm-unknown-linux-musleabi
|
|
# - armv7-unknown-linux-musleabihf
|
|
- x86_64-pc-windows-gnu
|
|
steps:
|
|
- name: download upload url
|
|
uses: actions/download-artifact@v2
|
|
with:
|
|
name: upload_url.txt
|
|
|
|
- name: get upload url
|
|
run: |
|
|
upload_url=`cat upload_url.txt`
|
|
echo "uploadurl=$upload_url" >> $GITHUB_ENV
|
|
|
|
- name: download asset
|
|
if: ${{ matrix.target != 'x86_64-pc-windows-gnu' }}
|
|
uses: actions/download-artifact@v2
|
|
with:
|
|
name: leaf-${{ matrix.target }}
|
|
|
|
- name: download asset
|
|
if: ${{ matrix.target == 'x86_64-pc-windows-gnu' }}
|
|
uses: actions/download-artifact@v2
|
|
with:
|
|
name: leaf-${{ matrix.target }}.exe
|
|
|
|
- name: zip artifacts
|
|
if: ${{ matrix.target != 'x86_64-pc-windows-gnu' }}
|
|
run: |
|
|
gzip leaf-${{ matrix.target }}
|
|
|
|
- name: zip artifacts
|
|
if: ${{ matrix.target == 'x86_64-pc-windows-gnu' }}
|
|
run: |
|
|
zip -9 leaf-${{ matrix.target }}.zip leaf-${{ matrix.target }}.exe
|
|
|
|
- name: upload asset
|
|
if: ${{ matrix.target != 'x86_64-pc-windows-gnu' }}
|
|
uses: actions/upload-release-asset@v1
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
with:
|
|
upload_url: ${{ env.uploadurl }}
|
|
asset_path: ./leaf-${{ matrix.target }}.gz
|
|
asset_name: leaf-${{ matrix.target }}.gz
|
|
asset_content_type: application/octet-stream
|
|
|
|
- name: upload asset
|
|
if: ${{ matrix.target == 'x86_64-pc-windows-gnu' }}
|
|
uses: actions/upload-release-asset@v1
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
with:
|
|
upload_url: ${{ env.uploadurl }}
|
|
asset_path: ./leaf-${{ matrix.target }}.zip
|
|
asset_name: leaf-${{ matrix.target }}.zip
|
|
asset_content_type: application/octet-stream
|
|
|
|
# release-lib:
|
|
# needs: [create-release]
|
|
# runs-on: macos-latest
|
|
# steps:
|
|
# - name: download upload url
|
|
# uses: actions/download-artifact@v2
|
|
# with:
|
|
# name: upload_url.txt
|
|
#
|
|
# - name: get upload url
|
|
# run: |
|
|
# upload_url=`cat upload_url.txt`
|
|
# echo "uploadurl=$upload_url" >> $GITHUB_ENV
|
|
#
|
|
# - name: install deps
|
|
# run: |
|
|
# brew update && brew install unzip
|
|
#
|
|
# - name: download asset
|
|
# uses: actions/download-artifact@v2
|
|
# with:
|
|
# name: libleaf-ios.zip
|
|
#
|
|
# - name: upload asset
|
|
# uses: actions/upload-release-asset@v1
|
|
# env:
|
|
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
# with:
|
|
# upload_url: ${{ env.uploadurl }}
|
|
# asset_path: ./libleaf-ios.zip
|
|
# asset_name: libleaf-ios.zip
|
|
# asset_content_type: application/octet-stream
|