Skip to content

Commit

Permalink
update cd-maven-release.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
enricostara committed Jul 16, 2023
1 parent 96d3f6e commit b5aea32
Showing 1 changed file with 34 additions and 17 deletions.
51 changes: 34 additions & 17 deletions .github/workflows/cd-maven-release.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# This workflow will publish EA releases to maven central and create the tag on git
# This workflow will publish RC releases to maven central and create the tag on git

name: Java CD for Release with Maven

Expand All @@ -9,7 +9,7 @@ permissions:
contents: write

jobs:
tag-release:
tag-rc-release:
runs-on: ubuntu-latest
steps:
- name: Checkout code
Expand Down Expand Up @@ -37,23 +37,40 @@ jobs:
echo "is_release_branch=false" >> $GITHUB_ENV
fi
# - name: Publish Release package
# if: env.is_release_branch == 'true'
# run: |
# export RELEASE=$(echo $GITHUB_REF_NAME | sed 's/^release\/\(.*\)$/\1/')
# export REVISION=$RELEASE
# echo "Maven Deploy: $REVISION"
# mvn --batch-mode -Denv=cd-maven -Drevision=$REVISION clean deploy
- name: Set up Git
if: env.is_release_branch == 'true'
run: |
echo "Setting up Git"
git --version
git config user.name "GitHub Action Bot"
git config user.email "<>"
- name: Get Release tag
if: env.is_release_branch == 'true'
id: latest_rc_tag
run: |
echo "Getting the latest RC tag"
current_release_version=$(echo "${{ github.ref }}" | sed 's/refs\/heads\/release\///')
echo "current_release_version=${current_release_version}"
echo "release_tag=${current_release_version}" >> $GITHUB_ENV
# - name: Deploy to Maven Central
# if: env.is_release_branch == 'true' && env.release_tag != ''
# env:
# GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
# OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }}
# OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}
# GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
# run: |
# echo "Deploying artifact with Release tag: ${{ env.release_tag }}"
# mvn --batch-mode -DskipTests -Denv=cd-maven -Drevision=${{ env.release_tag }} clean deploy

- name: Create tag
if: env.is_release_branch == 'true'
id: release_tag
- name: Create new Release tag
if: env.is_release_branch == 'true' && env.release_tag != ''
run: |
echo "Creating new Release tag: ${{ env.release_tag }}"
git tag ${{ env.release_tag }}
- name: Push Release tag to GitHub
if: env.is_release_branch == 'true' && env.release_tag != ''
run: |
tag=$(echo "${{ github.ref }}" | sed 's/refs\/heads\/release\///')
echo "tag=${tag}"
console.log('Git Tag: ' + tag);
git tag ${{ tag }}
echo "Pushing Release tag to GitHub: ${{ env.release_tag }}"
git push origin ${{ env.release_tag }}

0 comments on commit b5aea32

Please sign in to comment.