From 5d297d882d3fea256f4059f022250b05e191f0a9 Mon Sep 17 00:00:00 2001 From: Sven F Date: Mon, 28 Feb 2022 17:17:17 +0100 Subject: [PATCH] Add workflow triggers (#51) --- .github/workflows/build-package.yml | 16 +++++++++++++++- .github/workflows/create-release.yml | 13 ++++++++----- .github/workflows/run-tests.yml | 8 +++++++- 3 files changed, 30 insertions(+), 7 deletions(-) diff --git a/.github/workflows/build-package.yml b/.github/workflows/build-package.yml index f6287909..fcf076fb 100644 --- a/.github/workflows/build-package.yml +++ b/.github/workflows/build-package.yml @@ -1,6 +1,12 @@ name: Build Maven Package -on: [push] +on: + push: + branches: + - '*' + pull_request: + # The branches below must be a subset of the branches above + branches: [ main, master ] jobs: package: @@ -13,5 +19,13 @@ jobs: with: java-version: 1.8 + - name: Load local Maven repository cache + uses: actions/cache@v2 + with: + path: ~/.m2/repository + key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} + restore-keys: | + ${{ runner.os }}-maven- + - name: Run mvn package run: mvn -B package --file pom.xml diff --git a/.github/workflows/create-release.yml b/.github/workflows/create-release.yml index 77404ecd..82efca7d 100644 --- a/.github/workflows/create-release.yml +++ b/.github/workflows/create-release.yml @@ -44,7 +44,7 @@ jobs: || contains(github.event.inputs.versionTag, 'rc')) }} uses: actions/github-script@v4.0.2 with: - github-token: ${{secrets.GITHUB_TOKEN}} + github-token: ${{secrets.JOHNNY_Q5_REPORTS_TOKEN}} script: | await github.request(`POST /repos/${{ github.repository }}/releases`, { tag_name: "${{ github.event.inputs.versionTag }}", @@ -58,7 +58,7 @@ jobs: || contains(github.event.inputs.versionTag, 'rc')) }} uses: actions/github-script@v4.0.2 with: - github-token: ${{secrets.GITHUB_TOKEN}} + github-token: ${{secrets.JOHNNY_Q5_REPORTS_TOKEN}} script: | await github.request(`POST /repos/${{ github.repository }}/releases`, { tag_name: "${{ github.event.inputs.versionTag }}", @@ -75,16 +75,19 @@ jobs: - name: Switch to new branch run: git checkout -b release/set-version-to-${{ github.event.inputs.versionTag }} + - name: Set remote branch + run: git push --set-upstream origin release/set-version-to-${{ github.event.inputs.versionTag }} + - name: Checkin commit run: git commit . -m 'Set version to ${{ github.event.inputs.versionTag }}' - - name: Set remote branch - run: git push --set-upstream origin release/set-version-to-${{ github.event.inputs.versionTag }} + - name: Push to Github + run: git push - name: Open PR with version bump uses: actions/github-script@v4.0.2 with: - github-token: ${{secrets.GITHUB_TOKEN}} + github-token: ${{secrets.JOHNNY_Q5_REPORTS_TOKEN}} script: | await github.request(`POST /repos/${{ github.repository }}/pulls`, { title: 'Update version to ${{ github.event.inputs.versionTag }}', diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index 23fafb97..ab4e81d9 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -1,6 +1,12 @@ name: Run Maven Tests -on: [push] +on: + push: + branches: + - '*' + pull_request: + # The branches below must be a subset of the branches above + branches: [ main, master ] jobs: test: