Skip to content

Commit

Permalink
Update Release Workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
LitschiW committed Oct 29, 2022
1 parent a1bd400 commit 3611538
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 5 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/checkstyle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ name: Run Checkstyle

on:
push:
pull_request_target:
branches: [ master ]

jobs:
run_checkstyle:
Expand All @@ -12,7 +14,7 @@ jobs:
- uses: actions/checkout@v3

- name: Set up Java 16
uses: actions/setup-java@v2
uses: actions/setup-java@v3
with:
java-version: '16'
distribution: 'adopt'
Expand Down
45 changes: 41 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,16 @@ on:
branches: [ master ]

jobs:
release:
Prepare-and-Release:
name: Prepare and Release
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v3

- name: Set up Java 16
uses: actions/setup-java@v2
uses: actions/setup-java@v3
with:
java-version: '16'
distribution: 'adopt'
Expand All @@ -25,12 +26,48 @@ jobs:
git config --global committer.name "GitHub Release Workflow"
git config --global author.email "${GITHUB_ACTOR}@users.noreply.github.com"
git config --global author.name "${GITHUB_ACTOR}"
- name: Get Maven version
run: |
export MAVEN_VERSION=$( mvn help:evaluate -Dexpression=project.version -q -DforceStdout | sed "s/-SNAPSHOT$//" )
echo "Retreived Maven Version: $MAVEN_VERSION"
echo "MAVEN_VERSION=$MAVEN_VERSION" >> $GITHUB_ENV
- name: Release Maven Artifact
- name: Prepare & Release Maven Artifact
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: mvn -B release:prepare release:perform
run: |
git checkout -B "MiSim-${{env.MAVEN_VERSION}}"
mvn -B release:prepare release:perform
git clean -f
- name: Create Pull Request to Master
id: open-pr
uses: repo-sync/pull-request@v2
with:
source_branch: "MiSim-${{env.MAVEN_VERSION}}"
pr_title: "Prepare Release ${{env.MAVEN_VERSION}}"
pr_body: "This pull request updates the MiSim pom for version ${{env.MAVEN_VERSION}} and prepares the next Snapshot.<br>It will be merged automatically."
# pr_assignee: "LitschiW"
pr_allow_empty: false
pr_label: "automerge"
github_token: ${{ secrets.PUBLISHER_TOKEN }}

- name: Automerge Pull Request
id: automerge
env:
PULL_REQUEST: ${{steps.open-pr.outputs.pr_number}}
MERGE_COMMIT_MESSAGE: 'Update to ${{env.MAVEN_VERSION}} and prepare next SNAPSHOT'
MERGE_DELETE_BRANCH: true
MERGE_RETRIES: 5
MERGE_RETRY_SLEEP: '60000'
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
uses: "pascalgn/[email protected]"

- name: Check Merge Result
if: ${{ steps.automerge.outputs.mergeResult != 'merged' }}
run: |
echo "Merge of Pull Request ${{steps.open-pr.outputs.pr_number}} failed."
echo "Expected state 'merged', but found '${{steps.automerge.outputs.mergeResult}}'."
echo "See ${{steps.open-pr.outputs.pr_url}} for further info."
exit 1

0 comments on commit 3611538

Please sign in to comment.