Maven Release #5
This file contains hidden or 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: Maven Release | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| release_version: | |
| description: 'Release version' | |
| required: true | |
| development_version: | |
| description: 'Next development version' | |
| required: true | |
| permissions: | |
| contents: write # Ensure the action can push to the repository | |
| jobs: | |
| release: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v3 | |
| with: | |
| fetch-depth: 0 # Fetch all history for full tag support | |
| - name: Set up JDK 1.8 | |
| uses: actions/setup-java@v3 | |
| with: | |
| distribution: 'temurin' | |
| java-version: '8' | |
| - name: Cache Maven packages | |
| uses: actions/cache@v3 | |
| with: | |
| path: ~/.m2/repository | |
| key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }} | |
| restore-keys: | | |
| ${{ runner.os }}-m2 | |
| - name: Configure Git for release | |
| run: | | |
| git config user.name "GitHub Actions" | |
| git config user.email "actions@github.com" | |
| # Use HTTPS with GITHUB_TOKEN for authentication | |
| git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }} | |
| - name: Maven Release Prepare | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| mvn --batch-mode release:prepare \ | |
| -DreleaseVersion=${{ github.event.inputs.release_version }} \ | |
| -DdevelopmentVersion=${{ github.event.inputs.development_version }} \ | |
| -Dtag=${{ github.event.inputs.release_version }} \ | |
| -DpushChanges=true \ | |
| -DscmCommentPrefix="[skip ci] " | |
| - name: Maven Release Perform | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| ARTIFACTORY_USERNAME: ${{ secrets.ARTIFACTORY_USERNAME }} | |
| ARTIFACTORY_PASSWORD: ${{ secrets.ARTIFACTORY_PASSWORD }} | |
| run: | | |
| mvn --batch-mode release:perform \ | |
| -DaltDeploymentRepository=openmrs-repo-modules::default::https://openmrs.jfrog.io/artifactory/modules/ \ | |
| -Dusername=${{ secrets.ARTIFACTORY_USERNAME }} \ | |
| -Dpassword=${{ secrets.ARTIFACTORY_PASSWORD }} |