Post-merge/release workflow #33
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
name: Post-merge workflow | |
on: | |
workflow_dispatch: | |
pull_request: | |
types: | |
- closed | |
branches: | |
- main | |
jobs: | |
post_merge: | |
if: github.event.pull_request.merged == true | |
runs-on: ubuntu-latest | |
steps: | |
# | |
# Checkout the source code. | |
# | |
- name: Checkout the source code | |
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # 4.2.2 | |
with: | |
token: ${{ secrets.GIT_PAT }} | |
fetch-depth: 0 | |
# | |
# Calculate of the new version (dry-run). | |
# | |
- name: Calculate of the new version (dry-run) | |
uses: cycjimmy/semantic-release-action@b1b432f13acb7768e0c8efdec416d363a57546f2 # 4.1.1 | |
id: semantic | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
semantic_version: 21.1.1 | |
branch: main | |
extra_plugins: | | |
@semantic-release/[email protected] # 44c780c6f9c1bf2643fe48b6718bd9a84b820132 | |
@semantic-release/[email protected] # 3e934d45f97fd07a63617c0fc098c9ed3e67d97a | |
dry_run: true | |
# | |
# Setup Java Build Environment. | |
# | |
- name: Setup Java Build Environment | |
uses: ./.github/actions/setup-java-build-env | |
with: | |
gh_user: ${{ secrets.GIT_USER }} | |
gh_token: ${{ secrets.GIT_PAT }} | |
# | |
# Update of pom.xml with the new version + Git add + commit + push of the updated pom.xml. | |
# | |
- name: Update of pom.xml with the new version + Git add + commit + push of the updated pom.xml | |
if: steps.semantic.outputs.new_release_published == 'true' | |
run: | | |
${{ runner.temp }}/maven/bin/mvn versions:set -DnewVersion=${{ steps.semantic.outputs.new_release_version }} -s ${{ runner.temp }}/settings.xml --no-transfer-progress | |
git config user.name "GitHub Workflow" | |
git config user.email "<>" | |
git add pom.xml | |
git commit -m "pom.xml updated with new version ${{ steps.semantic.outputs.new_release_version }}" | |
git push origin main | |
# | |
# Calculation of the new version (again) with tagging + releasing + etc. | |
# | |
- name: Calculation of the new version (again) with tagging + releasing + etc | |
if: steps.semantic.outputs.new_release_published == 'true' | |
uses: cycjimmy/semantic-release-action@b1b432f13acb7768e0c8efdec416d363a57546f2 # 4.1.1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
semantic_version: 21.1.1 | |
branch: main | |
extra_plugins: | | |
@semantic-release/[email protected] # 44c780c6f9c1bf2643fe48b6718bd9a84b820132 | |
@semantic-release/[email protected] # 3e934d45f97fd07a63617c0fc098c9ed3e67d97a | |
dry_run: false | |
# | |
# Build and deploy. | |
# | |
- name: Build and deploy | |
if: steps.semantic.outputs.new_release_published == 'true' | |
run: ${{ runner.temp }}/maven/bin/mvn --batch-mode deploy -s ${{ runner.temp }}/settings.xml | |
# | |
# Build and deploy site. | |
# | |
- name: Build and deploy site | |
run: ${{ runner.temp }}/maven/bin/mvn --batch-mode site -s ${{ runner.temp }}/settings.xml --no-transfer-progress |