-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
44 additions
and
5 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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' | ||
|
@@ -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 |