Skip to content

Commit

Permalink
Update build action
Browse files Browse the repository at this point in the history
  • Loading branch information
RealCLanger committed Jan 20, 2024
1 parent 9c789f8 commit 7ca89d3
Showing 1 changed file with 31 additions and 22 deletions.
53 changes: 31 additions & 22 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ on:

jobs:
parameters:
name: Initialize Parameters and Versions
name: Gather Parameters
runs-on: ubuntu-latest
outputs:
publish: ${{ github.event.inputs.publish || true }}
Expand Down Expand Up @@ -84,10 +84,11 @@ jobs:
echo "agentVersion=$(echo $AGENT_VERSION)" >> $GITHUB_OUTPUT
- name: Download existing release file
uses: robinraju/release-downloader@v1.4
uses: robinraju/release-downloader@v1
continue-on-error: true
with:
tag: ${{ steps.versions.outputs.githubRelease }}
repository: ${{ github.repository }}
fileName: buildRef-${{ steps.versions.outputs.jmcVersion }}.txt

- name: Determine whether build is needed
Expand Down Expand Up @@ -116,25 +117,44 @@ jobs:
echo "doBuild=$(check_run)" >> $GITHUB_OUTPUT
echo "commit=$(echo $MY_REV)" >> $GITHUB_OUTPUT
build:
name: Build JMC
needs: parameters
if: needs.parameters.outputs.doBuild == 'true'
printparameters:
name: Print Parameters
needs: [parameters]
runs-on: ubuntu-latest
env:
MAVEN_OPTS: -Xmx2048m
MAVEN_CALL: mvn --batch-mode --no-transfer-progress
steps:
- name: Summarize parameters
- name: Print parameters
run: |
echo publish: ${{ needs.parameters.outputs.publish }}
echo release: ${{ needs.parameters.outputs.release }}
echo skipTests: ${{ needs.parameters.outputs.skipTests }}
echo githubRelease: ${{ needs.parameters.outputs.githubRelease }}
echo jmcVersion: ${{ needs.parameters.outputs.jmcVersion }}
echo agentVersion: ${{ needs.parameters.outputs.agentVersion }}
echo doBuild: ${{ needs.parameters.outputs.doBuild }}
echo commit: ${{ needs.parameters.outputs.commit }}
deleteold:
name: Delete old Release
needs: parameters
if: ${{ needs.parameters.outputs.doBuild == 'true' && needs.parameters.outputs.publish == 'true' && needs.parameters.outputs.release != 'true' }}
runs-on: ubuntu-latest
steps:
- name: Delete old GitHub release ${{ needs.parameters.outputs.githubRelease }}
continue-on-error: true
uses: dev-drprasad/[email protected]
with:
tag_name: ${{ needs.parameters.outputs.githubRelease }}
github_token: ${{ secrets.GITHUB_TOKEN }}

build:
name: Build JMC
needs: [parameters, deleteold]
if: needs.parameters.outputs.doBuild == 'true'
runs-on: ubuntu-latest
env:
MAVEN_OPTS: -Xmx2048m
MAVEN_CALL: mvn --batch-mode --no-transfer-progress
steps:
- name: Checkout JMC
uses: actions/checkout@v3
with:
Expand Down Expand Up @@ -200,25 +220,14 @@ jobs:
# with:
# run: ${{ env.MAVEN_CALL }} verify -P uitests

- name: Delete old GitHub release ${{ needs.parameters.outputs.githubRelease }}
if: ${{ needs.parameters.outputs.publish == 'true' && needs.parameters.outputs.release != 'true' }}
continue-on-error: true
uses: dev-drprasad/[email protected]
with:
delete_release: true
tag_name: ${{ needs.parameters.outputs.githubRelease }}
env:
GITHUB_TOKEN: ${{ github.token }}

- name: Create/Update GitHub release ${{ needs.parameters.outputs.githubRelease }}
if: needs.parameters.outputs.publish == 'true'
uses: ncipollo/release-action@v1.12.0
uses: ncipollo/release-action@v1
with:
tag: ${{ needs.parameters.outputs.githubRelease }}
commit: ${{ needs.parameters.outputs.commit }}
allowUpdates: ${{ needs.parameters.outputs.release != 'true' }}
prerelease: ${{ needs.parameters.outputs.release != 'true' }}
draft: false

- name: Upload buildRef-${{ needs.parameters.outputs.jmcVersion }}.txt
if: needs.parameters.outputs.publish == 'true'
Expand Down

0 comments on commit 7ca89d3

Please sign in to comment.