From e81ef4244a0109cd536bccc78b059af4d08e0f1c Mon Sep 17 00:00:00 2001 From: hugh-unicenta Date: Mon, 13 Nov 2023 13:40:41 +0000 Subject: [PATCH] adding gh action maven build --- .github/workflows/mvn-build.yml | 77 +++++++++++++++++++++++++++++++++ 1 file changed, 77 insertions(+) create mode 100644 .github/workflows/mvn-build.yml diff --git a/.github/workflows/mvn-build.yml b/.github/workflows/mvn-build.yml new file mode 100644 index 0000000..e303e55 --- /dev/null +++ b/.github/workflows/mvn-build.yml @@ -0,0 +1,77 @@ +name: Maven Project Build + +on: [workflow_dispatch] + +jobs: + build: + runs-on: ubuntu-latest + env: + SEGMENT_DOWNLOAD_TIMEOUT_MINS: '2' + steps: + - name: Clone repo + uses: actions/checkout@v3 + with: + repository: uniCenta/unicenta-opos + token: ${{ secrets.ACCESS_TOKEN }} + + - name: check for files + run: ls -ltr + + - name: Check uniCenta maven repo + run: curl https://repo.unicenta.org/maven2 + + - name: Check IP address + run: curl ipinfo.io/ip + + - name: Cache Maven packages + uses: actions/cache@v2 + with: + path: ~/.m2 + key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }} + restore-keys: | + ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }} + ${{ runner.os }}-m2- + + - name: Set up JDK 11 + uses: actions/setup-java@v3 + with: + java-version: '11' + distribution: 'adopt' + architecture: x64 + cache: maven + + - name: Build with Maven + run: mvn clean package + + - name: check for jar + run: ls -ltr ./target/ + + - name: Set version of application + run: echo "APP_VERSION=$(unzip -q -c target/unicentaopos.jar META-INF/MANIFEST.MF | grep -oP '(?<=Implementation-Version:\s)[0-9_.-]*')" >> $GITHUB_ENV + + - name: upload build + uses: actions/upload-artifact@v2 + with: + name: build + path: target + + - name: Build linx deb 64 + uses: benc-uk/workflow-dispatch@v1.1 + with: + workflow: Linux deb 64bit build + token: ${{ secrets.ACCESS_TOKEN }} + inputs: '{ "version": "${{ env.APP_VERSION }}"}' + + - name: Build Windows 64 + uses: benc-uk/workflow-dispatch@v1.1 + with: + workflow: Windows 64bit build + token: ${{ secrets.ACCESS_TOKEN }} + inputs: '{ "version": "${{ env.APP_VERSION }}"}' + + - name: Build MacOS Intel + uses: benc-uk/workflow-dispatch@v1.1 + with: + workflow: MACOS Intel build + token: ${{ secrets.ACCESS_TOKEN }} + inputs: '{ "version": "${{ env.APP_VERSION }}"}'