Release with Gradle #29
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: Release with Gradle | |
on: | |
workflow_dispatch: | |
jobs: | |
release: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
token: ${{ secrets.PAT }} | |
- name: Set up JDK 8 | |
uses: actions/setup-java@v4 | |
with: | |
java-version: '8' | |
distribution: 'temurin' | |
- name: Setup Gradle | |
uses: gradle/actions/setup-gradle@417ae3ccd767c252f5661f1ace9f835f9654f2b5 # v3.1.0 | |
- name: Release with Gradle | |
id: release | |
env: | |
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }} | |
OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }} | |
KEY_ID: ${{ secrets.KEY_ID }} | |
PASSWORD: ${{ secrets.PASSWORD }} | |
SECRET_KEY_RING_BASE64: ${{ secrets.SECRET_KEY_RING_BASE64 }} | |
run: | | |
git config --global user.name 'GitHub Actions' | |
git config --global user.email '[email protected]' | |
./gradlew clean releaseVersion -PossrhUsername=ignore -PossrhPassword=ignore2 | |
git add gradle.properties | |
git commit -m "Update jSuplaVersion to release version in gradle.properties" | |
echo -n "$SECRET_KEY_RING_BASE64" | base64 --decode > secring.gpg | |
./gradlew noSnapshots build publish tag \ | |
-PossrhUsername=$OSSRH_USERNAME \ | |
-PossrhPassword=$OSSRH_PASSWORD \ | |
-Psigning.keyId=$KEY_ID \ | |
-Psigning.password=$PASSWORD \ | |
-Psigning.secretKeyRingFile=$(realpath ./secring.gpg) \ | |
-PskipSigning=false | |
# Define the file path | |
FILE="build/tag.txt" | |
# Check if the file exists | |
if [ -f "$FILE" ]; then | |
# Read the content of the file into the TAG variable | |
TAG=$(cat "$FILE") | |
echo "tag value: $TAG" | |
echo "tag=$TAG" >> $GITHUB_OUTPUT | |
echo "New tag $tag" | |
git tag $TAG | |
echo "Pushing tag..." | |
git push origin $TAG | |
else | |
echo "File $FILE does not exist." | |
exit 33 | |
fi | |
./gradlew nextSnapshot -PossrhUsername=ignore -PossrhPassword=ignore2 | |
git add gradle.properties | |
git commit -m "Update jSuplaVersion to SNAPSHOT version in gradle.properties" | |
echo "Pushing master to origin..." | |
git push origin master |