Skip to content

Commit

Permalink
Update publish-maven.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
VuzZis committed Feb 5, 2025
1 parent fb4b1a8 commit ff16e1f
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions .github/workflows/publish-maven.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,19 @@ jobs:
uses: gradle/actions/setup-gradle@417ae3ccd767c252f5661f1ace9f835f9654f2b5 # v3.1.0
- name: Change wrapper permissions
run: chmod +x ./gradlew

- name: Build Mod
run: ./gradlew build --stacktrace

- name: Read shouldPublish property
id: read_properties
run: |
shouldPublish=$(grep '^shouldPublish=' gradle.properties | cut -d'=' -f2)
echo "shouldPublish=${shouldPublish}" >> $GITHUB_ENV
- name: Set first release tag
run: |
current_version=$(grep '^version=' gradle.properties | cut -d'=' -f2)
echo "TAG_NAME=$(current_version)" >> $GITHUB_ENV
- name: Increment version
if: ${{ env.shouldPublish == 'true' && github.repository == 'KomaruPRO/Tridot' }}
run: |
Expand All @@ -51,9 +59,12 @@ jobs:
new_version="$base_version-$new_last_version"
echo "New version: $new_version"
echo "TAG_NAME=$(new_version)" >> $GITHUB_ENV
# Update the version line in gradle.properties
sed -i "s/^version=.*/version=$new_version/" gradle.properties
cat gradle.properties
- name: Commit and Push Version Change
if: ${{ env.shouldPublish == 'true' && github.repository == 'KomaruPRO/Tridot' }}
run: |
Expand All @@ -62,10 +73,29 @@ jobs:
git add gradle.properties
git commit -m "Increment version to $new_version"
git push
- name: Upload Artifacts
uses: actions/upload-artifact@v4
with:
name: Tridot
path: |
./build/libs/*.jar
./libs/*.jar
- name: Publish Maven Version
env:
maventoken: ${{ secrets.MAVEN_PASSWORD }}
if: ${{ env.shouldPublish == 'true' && github.repository == 'KomaruPRO/Tridot' }}
run: |
./gradlew clean
./gradlew publish
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ env.TAG_NAME }}
name: "Release ${{ env.TAG_NAME }}"
body: "Automatic release"
files: ./build/libs/*.jar
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 comments on commit ff16e1f

Please sign in to comment.