From 9f9b6683a67824e2cc79d0c129a3feddbffbffd4 Mon Sep 17 00:00:00 2001 From: Shaun Hare Date: Sat, 11 May 2024 09:54:02 +0100 Subject: [PATCH] tweaked workflows --- .github/workflows/cd.yaml | 13 +++++-------- .github/workflows/ci.yaml | 4 +++- .github/workflows/maven.yaml | 25 +++++++++++++++++++++++++ .github/workflows/maven_build.yaml | 19 ------------------- 4 files changed, 33 insertions(+), 28 deletions(-) create mode 100644 .github/workflows/maven.yaml delete mode 100644 .github/workflows/maven_build.yaml diff --git a/.github/workflows/cd.yaml b/.github/workflows/cd.yaml index a9ff7cd..3cca501 100644 --- a/.github/workflows/cd.yaml +++ b/.github/workflows/cd.yaml @@ -20,20 +20,16 @@ jobs: id: release with: release-type: maven - - call-build-maven: - needs: release-please - name: build with Maven - uses: ./.github/workflows/maven_build.yaml + publish: + if: ${{needs.release-please.outputs.release_created}} runs-on: ubuntu-latest permissions: contents: read packages: write needs: - release-please - - call-build-maven steps: - name: checkout code uses: actions/checkout@v4 @@ -46,8 +42,9 @@ jobs: cache: 'maven' - name: Publish to GitHub Packages Apache Maven - if: ${{needs.release-please.outputs.release_created}} - run: mvn --batch-mode deploy + uses: ./.github/workflows/maven.yaml + with: + maven-goal: deploy env: GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 72604eb..670cca0 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -11,7 +11,9 @@ jobs: build-maven: name: build with Maven - uses: ./.github/workflows/maven_build.yaml + uses: ./.github/workflows/maven.yaml + with: + maven-goal: 'package' needs: security diff --git a/.github/workflows/maven.yaml b/.github/workflows/maven.yaml new file mode 100644 index 0000000..87f4ff6 --- /dev/null +++ b/.github/workflows/maven.yaml @@ -0,0 +1,25 @@ +name: Maven + +on: + workflow_call: + inputs: + maven-goal: + description: 'Maven goal to run' + required: true + default: 'package' + type: string + +permissions: + contents: read + + +jobs: + build: + name: build + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - run: mvn -B -P github ${{ inputs.maven-goal}} + + \ No newline at end of file diff --git a/.github/workflows/maven_build.yaml b/.github/workflows/maven_build.yaml deleted file mode 100644 index 72d2b9f..0000000 --- a/.github/workflows/maven_build.yaml +++ /dev/null @@ -1,19 +0,0 @@ -name: Maven Build - -on: - workflow_call: - -permissions: - contents: read - packages: write - -jobs: - build: - name: build - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - - run: mvn -B -P github package - - \ No newline at end of file