Merge pull request #17 from pauldaustin/feature/websocket #45
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build | |
on: | |
push: | |
tags: | |
- '*' | |
branches: | |
- main | |
- '[0-9]+.[0-9]+.x' | |
workflow_dispatch: | |
inputs: | |
tag: | |
description: 'Tag to build' | |
required: false | |
branch: | |
description: 'Branch to build' | |
required: false | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
#### JAVA VERSION #### | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v3 | |
with: | |
java-version: '17' | |
distribution: 'microsoft' | |
#### Initialize Environment #### | |
- name: Initialize Environment | |
run: | | |
TAG="${{github.event.inputs.tag}}" | |
BRANCH="${{github.event.inputs.branch}}" | |
if [[ -z "$TAG" && -z "$BRANCH" ]]; then | |
REF="$GITHUB_REF" | |
if [[ "$REF" =~ ^refs/heads/.* ]]; then | |
BRANCH="${REF/refs\/heads\//}" | |
elif [[ "$REF" =~ ^refs/tags/.* ]]; then | |
TAG="${REF/refs\/tags\//}" | |
else | |
echo "Ref must be a branch or tag '${REF}'" | |
exit -1 | |
fi | |
fi | |
if [[ ! -z "$TAG" ]]; then | |
REF=${TAG} | |
OTHER_REF=0.GBA-${TAG} | |
else | |
REF=${BRANCH} | |
OTHER_REF=$REF | |
fi | |
echo "REF=${REF}" >> $GITHUB_ENV | |
echo "OTHER_REF=${OTHER_REF}" >> $GITHUB_ENV | |
#### Checkout jeometry #### | |
- name: Checkout jeometry | |
uses: actions/checkout@v3 | |
with: | |
ref: ${{env.OTHER_REF}} | |
path: jeometry | |
#### MAVEN REPOSITORY CACHE #### | |
- uses: actions/cache@v3 | |
with: | |
path: | | |
'~/.m2/repository' | |
'!~/.m2/repository/org/jeometry' | |
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} | |
restore-keys: | | |
${{ runner.os }}-maven- | |
#### Build & Deploy #### | |
- name: Build & Deploy | |
working-directory: ./jeometry | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: mvn -B deploy -DskipTests -DgitHubRepo=${{github.repository}} |