Skip to content

Build

Build #461

Workflow file for this run

# Copyright (c) 2022 github.com/System233
#
# This software is released under the MIT License.
# https://opensource.org/licenses/MIT
name: Build
on:
schedule:
- cron: "0 0 * * *"
workflow_dispatch:
push:
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
android_abi: [armeabi-v7a, arm64-v8a, x86, x86_64]
android_platform:
[34, 33, 32, 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 19]
type: [shared, static]
exclude:
- android_platform: 19
android_abi: arm64-v8a
- android_platform: 19
android_abi: x86_64
fail-fast: false
steps:
- uses: actions/checkout@v4
- name: Preflight
id: preflight
run: |
ANDROID_ABI=${{matrix.android_abi}}
ANDROID_PLATFORM=${{matrix.android_platform}}
BUILD_TYPE=${{matrix.type}}
BOOST_VERSION=$(./latest-boost-version.sh)
echo BOOST_VERSION=$BOOST_VERSION
ICU_VERSION=$(./latest-icu-version.sh)
echo ICU_VERSION=$ICU_VERSION
ICU_NAME=$(echo $ICU_VERSION|grep -oP "release-\\K(.*)"|sed -e "s/-/./g")
echo ICU_NAME=$ICU_NAME
ANDROID_ABI_NO_HYPHEN=$(echo $ANDROID_ABI | sed 's/-//g')
BOOST_DIST_NAME=$BOOST_VERSION-icu$ICU_NAME-android$ANDROID_PLATFORM-$ANDROID_ABI_NO_HYPHEN-$BUILD_TYPE
echo BUILD_OUTPUT=$BOOST_DIST_NAME
TAG_NAME=$BOOST_VERSION-icu$ICU_NAME
echo TAG_NAME=$TAG_NAME
echo "BOOST_VERSION=$BOOST_VERSION" >> $GITHUB_OUTPUT
echo "ICU_VERSION=$ICU_VERSION" >> $GITHUB_OUTPUT
echo "TAG_NAME=$TAG_NAME" >> $GITHUB_OUTPUT
echo "DIST_NAME=$BOOST_DIST_NAME" >> $GITHUB_OUTPUT
BUILD_STATE=$(curl "$GITHUB_API_URL/repos/$GITHUB_REPOSITORY/releases/tags/$TAG_NAME" --header 'authorization: Bearer ${{ secrets.GITHUB_TOKEN }}' 2>/dev/null|jq -r --arg FILE "$BOOST_DIST_NAME.tar.gz" '.assets | map(.name == $FILE) | any')
echo "BUILD_STATE=$BUILD_STATE" >> $GITHUB_OUTPUT
- name: Build
if: steps.preflight.outputs.BUILD_STATE == 'false'
run: |
ANDROID_ABI=${{matrix.android_abi}}
ANDROID_PLATFORM=${{matrix.android_platform}}
BUILD_TYPE=${{matrix.type}}
BOOST_VERSION=${{steps.preflight.outputs.BOOST_VERSION}}
ICU_VERSION=${{steps.preflight.outputs.ICU_VERSION}}
./build.sh $ANDROID_ABI $ANDROID_PLATFORM $BOOST_VERSION $ICU_VERSION $BUILD_TYPE
- name: Archive
if: steps.preflight.outputs.BUILD_STATE == 'false'
run: |
cd dist
zip -9 ../${{steps.preflight.outputs.DIST_NAME}}.zip -r .
tar -czf ../${{steps.preflight.outputs.DIST_NAME}}.tar.gz .
cd ..
sha1sum ${{steps.preflight.outputs.DIST_NAME}}.zip >${{steps.preflight.outputs.DIST_NAME}}.zip.sha1
sha1sum ${{steps.preflight.outputs.DIST_NAME}}.tar.gz >${{steps.preflight.outputs.DIST_NAME}}.tar.gz.sha1
- name: Release
uses: softprops/action-gh-release@v2
if: steps.preflight.outputs.BUILD_STATE == 'false' && (github.ref == 'refs/heads/main' || github.event_name != 'push')
with:
tag_name: ${{steps.preflight.outputs.TAG_NAME}}
body: |
Boost: [${{steps.preflight.outputs.BOOST_VERSION}}](https://github.com/boostorg/boost/tree/${{steps.preflight.outputs.BOOST_VERSION}})
ICU: [${{steps.preflight.outputs.ICU_VERSION}}](https://github.com/unicode-org/icu/tree/${{steps.preflight.outputs.ICU_VERSION}})
files: |
${{steps.preflight.outputs.DIST_NAME}}.zip
${{steps.preflight.outputs.DIST_NAME}}.zip.sha1
${{steps.preflight.outputs.DIST_NAME}}.tar.gz
${{steps.preflight.outputs.DIST_NAME}}.tar.gz.sha1