Merge pull request #45 from SelahattinSert/push-docker-image-to-acr #7
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: Post-Merge Version Update | |
| on: | |
| push: | |
| branches: | |
| - main | |
| jobs: | |
| update-version: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v3 | |
| - name: Set Up Java | |
| uses: actions/setup-java@v3 | |
| with: | |
| java-version: '21' | |
| distribution: 'temurin' | |
| cache: 'maven' | |
| - name: Set new version | |
| run: | | |
| export REVISION_ID=$(git rev-parse --short HEAD) | |
| export NEW_VERSION=$(date +%Y%m%d)-$REVISION_ID | |
| echo "Setting version to $NEW_VERSION" | |
| echo "NEW_VERSION=$NEW_VERSION" >> $GITHUB_ENV | |
| mvn versions:set -DnewVersion=$NEW_VERSION | |
| mvn versions:commit | |
| - name: Commit and push changes | |
| run: | | |
| git config user.name "GitHub Actions Bot" | |
| git config user.email "actions@github.com" | |
| git add pom.xml | |
| git commit -m "Update project version to ${{ env.NEW_VERSION }}" | |
| git pull --rebase | |
| git push https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }} HEAD:main |