Skip to content

build all and publish jar #33

build all and publish jar

build all and publish jar #33

# This workflow will build Speedb library on Mac i86 and ARM, Ubuntu i86 and Arm, Windows i86. Then build a jar and publish to Maven central
#
name: build all and publish jar
on:
workflow_dispatch:
jobs:
pre_build:
runs-on: ubu-mvn-g
env:
VERSION_FILE: speedb/version.h
outputs:
out1: ${{ steps.find_version.outputs.verSion }}
steps:
- name: 'Cleanup build folder'
run: |
ls -la ./
rm -rf ./* || true
rm -rf ./.??* || true
ls -la ./
- name: 'Checkout GitHub Action'
uses: actions/checkout@v3
- name: 'find_version'
id: 'find_version'
run: |
major=$(grep '_MAJOR\s\+[0-9]\+' "$VERSION_FILE" | sed 's/[^0-9]\+//') && echo $major
minor=$(grep '_MINOR\s\+[0-9]\+' "$VERSION_FILE" | sed 's/[^0-9]\+//') && echo $minor
patch=$(( $(grep '_PATCH\s\+[0-9]\+' "$VERSION_FILE" | sed 's/[^0-9]\+//') + 1 )) && echo $patch
echo "verSion=$major.$minor.$patch" >> $GITHUB_OUTPUT
Mac_i86:
needs: pre_build
uses: ./.github/workflows/ci_macos.yml
with:
verSion: ${{ needs.pre_build.outputs.out1 }}
Mac_ARM:
needs: pre_build
uses: ./.github/workflows/ci_macos_ARM.yml
with:
verSion: ${{ needs.pre_build.outputs.out1 }}
Ubuntu_ARM:
needs: pre_build
uses: ./.github/workflows/ci_ubuntu_arm.yml
with:
verSion: ${{ needs.pre_build.outputs.out1 }}
Windows:
needs: pre_build
uses: ./.github/workflows/ci_windows.yml
with:
verSion: ${{ needs.pre_build.outputs.out1 }}
secrets:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_BUCKET: ${{ secrets.AWS_BUCKET }}
Build_and_upload:
needs: [pre_build, Mac_i86, Windows, Ubuntu_ARM]
runs-on: ubu-mvn-g
env:
VERSION_FILE: speedb/version.h
VERSION: ${{needs.pre_build.outputs.out1}}
outputs:
out1: ${{ steps.find_version.outputs.verSion }}
steps:
- name: 'Cleanup build folder'
run: |
ls -la ./
rm -rf ./* || true
rm -rf ./.??* || true
ls -la ./
- name: 'Checkout GitHub Action'
uses: actions/checkout@v3
- name: 'build'
run: |
export JAVA_HOME="$(jrunscript -e 'java.lang.System.out.println(java.lang.System.getProperty("java.home"));')"
export LIB_JAVA_VERSION=11.0.17
export the_version=${{ steps.find_version.outputs.verSion }}
export SPDB_LIB_DIR=~/spdb_lib && mkdir -p $SPDB_LIB_DIR
docker run --rm -v $(readlink -f ${SPDB_LIB_DIR}):/out -i speedb-centos-builder ${{ github.ref_name }}
cd java
mkdir src/main/resources
cp $SPDB_LIB_DIR/libspeedbjni-linux64.so src/main/resources
mv $SPDB_LIB_DIR/libspeedbjni-linux64.so{,_$(date '+%d_%m_%Y__%H_%M_%S')}
echo "aws s3 --profile nd7 cp --recursive s3://spdb-builder/jar_test/v$VERSION/ java/src/main/resources/"
sleep 180
aws s3 --profile nd7 cp --recursive s3://spdb-builder/jar_test/v$VERSION/ src/main/resources/
ls -l src/main/resources/
cp ../../../../../templ/pom.xml .
mvn versions:set -DnewVersion=$VERSION-SNAPSHOT
mvn deploy -X -e -DskipTests
mvn versions:set -DnewVersion=$the_version
#mvn clean deploy -P release -X -e -DskipTests
- name: show path
run: |
echo "versions:set -DnewVersion=$VERSION-SNAPSHOT"