diff --git a/.github/workflows/maven-publish.yml b/.github/workflows/maven-publish.yml index 647631f..262b651 100644 --- a/.github/workflows/maven-publish.yml +++ b/.github/workflows/maven-publish.yml @@ -34,3 +34,22 @@ jobs: MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }} MAVEN_PASSWORD: ${{ secrets.MAVEN_PASSWORD }} # Central Portal token MAVEN_GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} + + - name: Extract version and create tag + run: | + VERSION=$(sed -n 's/^[[:space:]]*\([^<]*\)<\/version>/\1/p' pom.xml | head -1) + + [ -n "$VERSION" ] || exit 1 + + git tag "$VERSION" 2>/dev/null || echo "Tag already exists" + git push origin "$VERSION" || true + + - name: Notify slack releases channel + uses: slackapi/slack-github-action@v2 + with: + webhook: ${{ secrets.SLACK_RELEASES_PROD_WEBHOOK_URL }} + webhook-type: webhook-trigger + payload: | + status: "${{ job.status }}" + environment: "PRODUCTION" + project: "LexActivator Java" diff --git a/.github/workflows/update-version.yml b/.github/workflows/update-version.yml index 5cadb4e..b5c0e92 100644 --- a/.github/workflows/update-version.yml +++ b/.github/workflows/update-version.yml @@ -15,24 +15,29 @@ on: jobs: update-version: runs-on: ubuntu-latest + env: + LIBRARY_VERSION: ${{ github.event.inputs.libraryVersion }} + PACKAGE_VERSION: ${{ github.event.inputs.packageVersion }} + steps: - name: Checkout code - uses: actions/checkout@v2 - - - name: Create new branch - run: git checkout -b release/${{ github.event.inputs.packageVersion }} + uses: actions/checkout@v4 - name: Update Version run: | - sed -i '/VERSION=/!b;cVERSION=\"v${{ github.event.inputs.libraryVersion }}";' ./download-libs.sh - sed -i '/jar<\/packaging>/,//s/[^<]*<\/version>/${{ github.event.inputs.libraryVersion }}<\/version>/' pom.xml - - name: Commit, Tag and Push - run: | - git add ./download-libs.sh - git add pom.xml - git config user.name github-actions - git config user.email github-actions@github.com - git commit -m "chore(package version): updated version" | exit 0 - git tag ${{ github.event.inputs.packageVersion }} - git push --set-upstream origin release/${{ github.event.inputs.packageVersion }} - git push --tags + sed -i -E 's/^([[:space:]]*)VERSION="[^"]*"/\1VERSION="v${{ env.LIBRARY_VERSION }}"/' ./download-libs.sh + sed -i '/jar<\/packaging>/,//s/[^<]*<\/version>/${{ env.LIBRARY_VERSION }}<\/version>/' pom.xml + + - name: Create Pull Request + uses: peter-evans/create-pull-request@v5 + with: + branch: ci/${{ env.PACKAGE_VERSION }} + title: "chore: bump package version to ${{ env.PACKAGE_VERSION }}" + commit-message: "chore(package version): updated version" + body: | + Automated package version bump. + base: master + add-paths: | + ./download-libs.sh + pom.xml +