Skip to content

Commit

Permalink
add dev build workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
spydmobile committed Mar 1, 2023
1 parent 7997710 commit 6e1a372
Showing 1 changed file with 212 additions and 0 deletions.
212 changes: 212 additions & 0 deletions .github/workflows/maven-dev-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,212 @@
# This workflow will build a package using Maven and then publish it to GitHub packages when a release is created
# For more information see: https://github.com/actions/setup-java/blob/main/docs/advanced-usage.md#apache-maven-with-a-settings-path

name: Maven Developer

on:
workflow_dispatch

env:
PROTO_VERSION: 21.10

jobs:
build:

runs-on: ubuntu-latest
permissions:
contents: write
packages: read

steps:
- uses: actions/[email protected]
with:
ref: developer
fetch-depth: 0
- uses: actions/[email protected]
with:
ref: developer
repository: WISE-Developers/WISE_Versions
path: versions
- uses: actions/[email protected]
with:
ref: developer
repository: WISE-Developers/WISE_Communications_Module
path: WISE_Communications_Module

- name: Set up JDK 8
uses: actions/setup-java@v3
with:
java-version: '8'
distribution: 'temurin'
server-id: github

- name: Setup the Maven configuration file
uses: whelk-io/maven-settings-xml-action@v21
with:
servers: '[{ "id": "github", "username": "spydmobile", "password": "${{ secrets.WISE_PAT }}" }, { "id": "github_hss", "username": "spydmobile", "password": "${{ secrets.WISE_PAT }}" }]'

- name: Load values from versions
id: version-numbers
shell: pwsh
run: |
$versions = ConvertFrom-StringData (Get-Content versions/versions.properties -raw)
echo "Updating to version $($versions.wise)-dev-$(date +'%Y-%m-%d')_$(date +'%H.%M')"
echo "wise_top_version=$($versions.wise)-dev-$(date +'%Y-%m-%d')_$(date +'%H.%M')" >> $env:GITHUB_OUTPUT
echo "hss_math_version=$($versions.hss_math)" >> $env:GITHUB_OUTPUT
echo "wtime_version=$($versions.wtime)" >> $env:GITHUB_OUTPUT
echo "hss_java_version=$($versions.hss_java)" >> $env:GITHUB_OUTPUT
- name: Update the MAVEN versions
run: |
cd WISE_Communications_Module/WISE_Defaults/java
mvn versions:set -DnewVersion=${{ steps.version-numbers.outputs.wise_top_version }}
mvn versions:commit
cd -
cd WISE_Communications_Module/WISE_Status/java
mvn versions:set -DnewVersion=${{ steps.version-numbers.outputs.wise_top_version }}
mvn versions:commit
cd -
cd WISE_Communications_Module/WISE_Client_Comms/java
mvn versions:set -DnewVersion=${{ steps.version-numbers.outputs.wise_top_version }}
mvn versions:commit
cd -
cd WISE_Communications_Module/WISE_Server_Comms/java
mvn versions:set -DnewVersion=${{ steps.version-numbers.outputs.wise_top_version }}
mvn versions:commit
cd -
cd WISE_Manager_Interprocess
mvn versions:set -DnewVersion=${{ steps.version-numbers.outputs.wise_top_version }}
mvn versions:commit
cd -
cd WISE_Manager_Lib
mvn versions:set -DnewVersion=${{ steps.version-numbers.outputs.wise_top_version }}
mvn versions:use-dep-version -Dincludes=ca.hss:hss-java -DdepVersion=${{ steps.version-numbers.outputs.hss_java_version }} -DforceVersion=true
mvn versions:use-dep-version -Dincludes=ca.wise:job-status -DdepVersion=${{ steps.version-numbers.outputs.wise_top_version }} -DforceVersion=true
mvn versions:use-dep-version -Dincludes=ca.wise:server-comms -DdepVersion=${{ steps.version-numbers.outputs.wise_top_version }} -DforceVersion=true
mvn versions:use-dep-version -Dincludes=ca.wise:wise-defaults -DdepVersion=${{ steps.version-numbers.outputs.wise_top_version }} -DforceVersion=true
mvn versions:use-dep-version -Dincludes=ca.wise:client-comms -DdepVersion=${{ steps.version-numbers.outputs.wise_top_version }} -DforceVersion=true
mvn versions:commit
cd -
cd WISE_Manager_Ui
mvn versions:set -DnewVersion=${{ steps.version-numbers.outputs.wise_top_version }}
mvn versions:use-dep-version -Dincludes=ca.hss:hss-java -DdepVersion=${{ steps.version-numbers.outputs.hss_java_version }} -DforceVersion=true
mvn versions:use-dep-version -Dincludes=ca.wise:job-status -DdepVersion=${{ steps.version-numbers.outputs.wise_top_version }} -DforceVersion=true
mvn versions:use-dep-version -Dincludes=ca.wise:wise-manager-lib -DdepVersion=${{ steps.version-numbers.outputs.wise_top_version }} -DforceVersion=true
mvn versions:use-dep-version -Dincludes=ca.wise:wise-manager-interprocess -DdepVersion=${{ steps.version-numbers.outputs.wise_top_version }} -DforceVersion=true
mvn versions:commit
cd -
- name: Download protobuf
shell: pwsh
run: |
Invoke-WebRequest "https://heartlandsoftwaresolutions.sharepoint.com/:u:/g/HSS_Releases/EUZ4knsEFP5FjNHHWR5dHc0BofAFyEPdLKRvzAgaTuDi1w?e=XW0Muc&download=1" -OutFile protobuf.zip
Expand-Archive protobuf.zip -DestinationPath protobuf
mv protobuf/protobuf-3.${{ env.PROTO_VERSION }}/* protobuf
- name: Build protobuf
shell: pwsh
run: |
cd protobuf
cd cmake
mkdir build
cd build
cmake ../ -DCMAKE_BUILD_TYPE=Release -DCMAKE_POSITION_INDEPENDENT_CODE=ON
cmake --build . --target protoc
- name: Build Proto definition files
shell: pwsh
run: |
cd WISE_Communications_Module/WISE_Defaults
../../protobuf/cmake/build/protoc --experimental_allow_proto3_optional --java_out java/src/main/java --proto_path ../../protobuf/src --proto_path proto wise_config.proto
../../protobuf/cmake/build/protoc --experimental_allow_proto3_optional --java_out java/src/main/java --proto_path ../../protobuf/src --proto_path proto wise_defaults.proto
../../protobuf/cmake/build/protoc --experimental_allow_proto3_optional --java_out java/src/main/java --proto_path ../../protobuf/src --proto_path proto manager_settings.proto
cd ../WISE_Client_Comms
../../protobuf/cmake/build/protoc --experimental_allow_proto3_optional --java_out=java/src/main/java --proto_path ../../protobuf/src --proto_path proto file_upload.proto
cd ../WISE_Server_Comms
../../protobuf/cmake/build/protoc --experimental_allow_proto3_optional --java_out=java/src/main/java --proto_path ../../protobuf/src --proto_path proto file_upload.proto
../../protobuf/cmake/build/protoc --experimental_allow_proto3_optional --java_out=java/src/main/java --proto_path ../../protobuf/src --proto_path proto validation_report.proto
cd ../WISE_Status
../../protobuf/cmake/build/protoc --experimental_allow_proto3_optional --java_out=java/src/main/java --proto_path ../../protobuf/src --proto_path proto status.proto
- name: Build the libraries
id: library-build
run: |
cd WISE_Communications_Module/WISE_Defaults/java
mvn --batch-mode install
cd -
cd WISE_Communications_Module/WISE_Client_Comms/java
mvn --batch-mode install
cd -
cd WISE_Communications_Module/WISE_Server_Comms/java
mvn --batch-mode install
cd -
cd WISE_Communications_Module/WISE_Status/java
mvn --batch-mode install
cd -
cd WISE_Manager_Interprocess
mvn --batch-mode install
cd -
cd WISE_Manager_Lib
mvn --batch-mode install
cd -
cd WISE_Manager_Ui
mvn --batch-mode package
APPLICATION_VERSION=$(mvn -q -Dexec.executable=echo -Dexec.args='${project.version}' --non-recursive exec:exec | cut -d "." -f2-)
APPLICATION_VERSION=$(echo "${APPLICATION_VERSION/-/.}")
echo "user_friendly_version=$APPLICATION_VERSION" >> $GITHUB_OUTPUT
CURRENT_DATE=$(date +'%Y%m%d')
echo "build_date=$CURRENT_DATE" >> $GITHUB_OUTPUT
- name: Archive generated files
shell: pwsh
run: |
mkdir zips
Compress-Archive -DestinationPath zips/WISE_Manager-${{ steps.library-build.outputs.user_friendly_version }}.zip -Path WISE_Manager_Ui/target/WISE_Manager_Ui.jar,WISE_Manager_Ui/target/lib
# - name: Tag the repositories
# id: last-tags
# run: |
# cd WISE_Communications_Module
# git config user.name github-actions
# git config user.email [email protected]
# git tag -a Manager_${{ steps.version-numbers.outputs.wise_top_version }} -m "W.I.S.E. Manager release on $(date +'%Y-%m-%d') for commit $(git rev-parse HEAD)"
# cd -
# git config user.name github-actions
# git config user.email [email protected]
# MANAGER_TAG=$(git describe --abbrev=0 --tags)
# echo "manager_tag=$MANAGER_TAG" >> $GITHUB_OUTPUT
# git tag -a ${{ steps.version-numbers.outputs.wise_top_version }} -m "W.I.S.E. Manager release on $(date +'%Y-%m-%d') for commit $(git rev-parse HEAD)"

# - name: Push comms changes
# uses: ad-m/github-push-action@master
# with:
# github_token: ${{ secrets.WISE_PAT }}
# repository: WISE-Developers/WISE_Communications_Module
# directory: WISE_Communications_Module
# tags: true

# - name: Push manager changes
# uses: ad-m/github-push-action@master
# with:
# tags: true

# - name: Create Release Notes
# id: manager-notes
# uses: mikepenz/[email protected]
# with:
# owner: WISE-Developers
# repo: WISE_Manager_Component
# configuration: notes-config.json
# toTag: ${{ steps.version-numbers.outputs.wise_top_version }}
# fromTag: ${{ steps.last-tags.outputs.manager_tag }}
# env:
# GITHUB_TOKEN: ${{ secrets.WISE_PAT }}

- name: Create release
uses: softprops/action-gh-release@v1
with:
name: ${{ steps.version-numbers.outputs.wise_top_version }}
body: ${{ steps.manager-notes.outputs.changelog }}
prerelease: true
files: zips/*.zip
tag_name: refs/tags/${{ steps.version-numbers.outputs.wise_top_version }}

0 comments on commit 6e1a372

Please sign in to comment.