Merge pull request #528 from Multiverse/new-readme #4
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: Create Release Version & Publish Package | |
on: | |
push: | |
branches: [main] | |
jobs: | |
release_on_push: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-java@v3 | |
with: | |
java-version: '11' | |
distribution: 'adopt' | |
cache: gradle | |
- name: Validate Gradle wrapper | |
uses: gradle/wrapper-validation-action@v1 | |
- name: Test & Build | |
uses: gradle/gradle-build-action@v2 | |
with: | |
arguments: clean build -x assemble -x shadowJar | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Create release | |
id: release | |
uses: Multiverse/release-on-push-action@support_prerelease | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
bump_version_scheme: norelease | |
tag_prefix: '' | |
release_name: "<RELEASE_VERSION>" | |
use_github_release_notes: true | |
- name: Modify version scheme | |
run: | | |
if [[ "${{ steps.release.outputs.tag_name }}" == *"pre"* ]]; then | |
echo "Replacing prerelease version scheme with SNAPSHOT" | |
echo "VERSION=$(echo ${{ steps.release.outputs.tag_name }} | sed -E 's/-pre.*/-SNAPSHOT/')" >> $GITHUB_ENV | |
else | |
echo "Using release version scheme" | |
echo "VERSION=${{ steps.release.outputs.tag_name }}" >> $GITHUB_ENV | |
fi | |
- name: Publish package | |
uses: gradle/gradle-build-action@v2 | |
with: | |
arguments: publish | |
env: | |
GITHUB_VERSION: ${{ env.VERSION }} | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Upload release artifact | |
uses: svenstaro/upload-release-action@v2 | |
with: | |
repo_token: ${{ secrets.GITHUB_TOKEN }} | |
file: build/libs/multiverse-inventories-${{ env.VERSION }}.jar | |
asset_name: multiverse-inventories-${{ steps.release.outputs.tag_name }}.jar | |
tag: ${{ steps.release.outputs.tag_name }} |