Skip to content

release: v1.0.0

release: v1.0.0 #34

Workflow file for this run

name: 01 Auto publish packages (Release)
on:
push:
branches:
- 'release/release-v*'
jobs:
create_release:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Extract version number
id: extract_version
shell: bash
run: |
VERSION="${GITHUB_REF#refs/heads/release/release-}"
echo "VERSION=$VERSION" >> $GITHUB_ENV
echo "Extracted version: $VERSION"
- name: Check if release tag exists
id: tag_exists
shell: bash
run: |
if git rev-parse "refs/tags/release-${{ env.VERSION }}" >/dev/null 2>&1; then
echo "exists=true" >> $GITHUB_ENV
else
echo "exists=false" >> $GITHUB_ENV
fi
echo "env.exists=$(cat $GITHUB_ENV | grep exists | cut -d '=' -f2)"
- name: Create GitHub Release
id: create_release
if: env.exists == 'false'
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: release-${{ env.VERSION }}
release_name: ADI ${{ env.VERSION }}
body_path: CHANGELOG.md
outputs:
upload_url: ${{ steps.create_release.outputs.upload_url }}
upload_assets:
needs: create_release
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ ubuntu-latest, macos-latest, windows-latest ]
platform: [ windows, linux, macos, android ]
build_type: [ minsizerel ]
arch: [ x86_64, aarch64, arm64, x86, arm64-v8a, armeabi-v7a ]
include:
- os: windows-latest
platform: windows # Platform: Windows (keep: x86_64, x86, arm64)
c_compiler: cl
cpp_compiler: cl
- os: macos-latest
platform: macos # Platform: MacOS (keep: x86_64, arm64)
c_compiler: clang
cpp_compiler: clang++
- os: ubuntu-latest
platform: linux # Platform: Linux (keep: x86_64, aarch64)
c_compiler: gcc
cpp_compiler: g++
- os: ubuntu-latest
platform: android # Platform: Android (keep: x86_64, x86, arm64-v8a, armeabi-v7a)
c_compiler: clang
cpp_compiler: clang++
exclude:
# Linux (keep: x86_64, aarch64)
- platform: linux
arch: arm64-v8a
- platform: linux
arch: armeabi-v7a
- platform: linux
arch: x86
- platform: linux
arch: arm64
# macOS (keep: x86_64, arm64)
- platform: macos
arch: arm64-v8a
- platform: macos
arch: armeabi-v7a
- platform: macos
arch: x86
- platform: macos
arch: aarch64
# Windows (keep: x86_64, x86, arm64)
- platform: windows
arch: arm64-v8a
- platform: windows
arch: armeabi-v7a
- platform: windows
arch: aarch64
# Android (keep: x86_64, x86, arm64-v8a, armeabi-v7a)
- platform: android
arch: aarch64
- platform: android
arch: arm64
# Exclude unsupported compiler combinations
- os: windows-latest
platform: linux
- os: windows-latest
platform: macos
- os: windows-latest
platform: android
- os: ubuntu-latest
platform: windows
- os: ubuntu-latest
platform: macos
- os: macos-latest
platform: windows
- os: macos-latest
platform: linux
- os: macos-latest
platform: android
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.x'
- name: Extract version from branch name
id: extract_version
shell: bash
run: |
VERSION="${GITHUB_REF#refs/heads/release/release-}"
echo "VERSION=$VERSION" >> $GITHUB_ENV
echo "Extracted version: $VERSION"
- name: Install dependencies (Linux)
if: matrix.os == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt-get install -y cmake ninja-build zip tar
sudo apt-get install -y gcc g++ gcc-aarch64-linux-gnu g++-aarch64-linux-gnu
- name: Install dependencies (macOS)
if: matrix.os == 'macos-latest'
run: |
brew install cmake ninja zip
- name: Install dependencies (Windows)
if: matrix.os == 'windows-latest'
run: |
choco install cmake ninja zip
- name: Set up Android SDK and NDK
if: matrix.platform == 'android'
uses: android-actions/setup-android@v2
with:
api-level: 27
ndk-version: 26.1.10909125
cmake-version: 3.29.5
- name: Build project (Linux, macOS, Windows)
if: matrix.platform != 'android'
shell: bash
run: |
bash ./auto_build.sh --platform ${{ matrix.platform }} \
--build-type ${{ matrix.build_type }} \
--arch-abi ${{ matrix.arch }} \
-c
- name: Build project (Android)
if: matrix.platform == 'android'
shell: bash
run: |
bash ./auto_build.sh --platform android \
--cmake "cmake" \
--ninja "ninja" \
--build-type ${{ matrix.build_type }} \
--arch-abi ${{ matrix.arch }} \
--jobs 4 \
--android-ndk "$ANDROID_NDK_HOME" \
--android-ver 27 \
-c
- name: Create release directory
shell: bash
run: |
mkdir -p release-${{ env.VERSION }}-${{ matrix.platform }}-${{ matrix.arch }}
- name: Copy files to release directory
shell: bash
run: |
cp -r include release-${{ env.VERSION }}-${{ matrix.platform }}-${{ matrix.arch }}/
cp -r cmake-build-${{ matrix.build_type }}-${{ matrix.platform }}-${{ matrix.arch }}/bin release-${{ env.VERSION }}-${{ matrix.platform }}-${{ matrix.arch }}/
cp -r cmake-build-${{ matrix.build_type }}-${{ matrix.platform }}-${{ matrix.arch }}/lib release-${{ env.VERSION }}-${{ matrix.platform }}-${{ matrix.arch }}/
cp CHANGELOG.md release-${{ env.VERSION }}-${{ matrix.platform }}-${{ matrix.arch }}/
cp README.md release-${{ env.VERSION }}-${{ matrix.platform }}-${{ matrix.arch }}/
cp LICENSE release-${{ env.VERSION }}-${{ matrix.platform }}-${{ matrix.arch }}/
- name: Create zip archive (Linux)
if: matrix.platform == 'linux'
shell: bash
run: |
tar -czvf release-${{ env.VERSION }}-${{ matrix.platform }}-${{ matrix.arch }}.tar.gz release-${{ env.VERSION }}-${{ matrix.platform }}-${{ matrix.arch }}
- name: Create zip archive (macOS)
if: matrix.platform == 'macos'
shell: bash
run: |
tar -czvf release-${{ env.VERSION }}-${{ matrix.platform }}-${{ matrix.arch }}.tar.gz release-${{ env.VERSION }}-${{ matrix.platform }}-${{ matrix.arch }}
- name: Create zip archive (Windows)
if: matrix.platform == 'windows'
shell: bash
run: |
zip -r release-${{ env.VERSION }}-${{ matrix.platform }}-${{ matrix.arch }}.zip release-${{ env.VERSION }}-${{ matrix.platform }}-${{ matrix.arch }}
- name: Create zip archive (Android)
if: matrix.platform == 'android'
shell: bash
run: |
zip -r release-${{ env.VERSION }}-${{ matrix.platform }}-${{ matrix.arch }}.zip release-${{ env.VERSION }}-${{ matrix.platform }}-${{ matrix.arch }}
- name: Upload release asset (Linux)
if: matrix.platform == 'linux'
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.create_release.outputs.upload_url }}
asset_path: release-${{ env.VERSION }}-${{ matrix.platform }}-${{ matrix.arch }}.tar.gz
asset_name: release-${{ env.VERSION }}-${{ matrix.platform }}-${{ matrix.arch }}.tar.gz
asset_content_type: application/gzip
- name: Upload release asset (macOS)
if: matrix.platform == 'macos'
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.create_release.outputs.upload_url }}
asset_path: release-${{ env.VERSION }}-${{ matrix.platform }}-${{ matrix.arch }}.tar.gz
asset_name: release-${{ env.VERSION }}-${{ matrix.platform }}-${{ matrix.arch }}.tar.gz
asset_content_type: application/gzip
- name: Upload release asset (Windows)
if: matrix.platform == 'windows'
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.create_release.outputs.upload_url }}
asset_path: release-${{ env.VERSION }}-${{ matrix.platform }}-${{ matrix.arch }}.zip
asset_name: release-${{ env.VERSION }}-${{ matrix.platform }}-${{ matrix.arch }}.zip
asset_content_type: application/zip
- name: Upload release asset (Android)
if: matrix.platform == 'android'
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.create_release.outputs.upload_url }}
asset_path: release-${{ env.VERSION }}-${{ matrix.platform }}-${{ matrix.arch }}.zip
asset_name: release-${{ env.VERSION }}-${{ matrix.platform }}-${{ matrix.arch }}.zip
asset_content_type: application/zip