|
| 1 | +name: Publish Dev Build |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - "**" # Any branch |
| 7 | + tags-ignore: |
| 8 | + - "v*" # Skip real releases |
| 9 | + |
| 10 | +jobs: |
| 11 | + build-dev: |
| 12 | + runs-on: ubuntu-latest |
| 13 | + |
| 14 | + steps: |
| 15 | + - name: Checkout |
| 16 | + uses: actions/checkout@v4 |
| 17 | + with: |
| 18 | + fetch-depth: 0 |
| 19 | + |
| 20 | + - name: Set up JDK |
| 21 | + uses: actions/setup-java@v4 |
| 22 | + with: |
| 23 | + distribution: "temurin" |
| 24 | + java-version: "21" |
| 25 | + cache: gradle |
| 26 | + |
| 27 | + - name: Get latest version tag v* |
| 28 | + id: tag |
| 29 | + run: | |
| 30 | + LAST_TAG=$(git describe --tags --match "v*" --abbrev=0) |
| 31 | + echo "tag=$LAST_TAG" >> $GITHUB_OUTPUT |
| 32 | + VERSION="${LAST_TAG#v}" |
| 33 | + echo "base_version=$VERSION" >> $GITHUB_OUTPUT |
| 34 | +
|
| 35 | + - name: Get short commit hash |
| 36 | + id: commit |
| 37 | + run: | |
| 38 | + HASH=$(git rev-parse --short HEAD) |
| 39 | + echo "hash=$HASH" >> $GITHUB_OUTPUT |
| 40 | +
|
| 41 | + - name: Compute dev version |
| 42 | + id: version |
| 43 | + run: | |
| 44 | + DEV_VERSION="${{ steps.tag.outputs.base_version }}+${{ steps.commit.outputs.hash }}-dev" |
| 45 | + echo "dev_version=$DEV_VERSION" >> $GITHUB_OUTPUT |
| 46 | +
|
| 47 | + - name: Setup Gradle |
| 48 | + uses: gradle/actions/setup-gradle@v3 |
| 49 | + |
| 50 | + - name: Grant execute permission for Gradle wrapper |
| 51 | + run: chmod +x ./gradlew |
| 52 | + |
| 53 | + - name: Build with Gradle |
| 54 | + run: ./gradlew build -PpluginVersion=${{ steps.version.outputs.dev_version }} |
| 55 | + |
| 56 | + - name: Get commit message |
| 57 | + id: message |
| 58 | + run: | |
| 59 | + MSG=$(git log -1 --pretty=%B) |
| 60 | + echo "message<<EOF" >> $GITHUB_OUTPUT |
| 61 | + echo "$MSG" >> $GITHUB_OUTPUT |
| 62 | + echo "EOF" >> $GITHUB_OUTPUT |
| 63 | +
|
| 64 | + - name: Modrinth Publish (Dev) |
| 65 | + uses: cloudnode-pro/modrinth-publish@v2.1.4 |
| 66 | + with: |
| 67 | + token: ${{ secrets.MODRINTH_TOKEN }} |
| 68 | + project: sd3UszWw |
| 69 | + name: "vHubs ${{ steps.version.outputs.dev_version }}" |
| 70 | + version: ${{ steps.version.outputs.dev_version }} |
| 71 | + channel: alpha |
| 72 | + changelog: | |
| 73 | + ${{ steps.message.outputs.message }} |
| 74 | +
|
| 75 | + _Be careful: This version is not production-ready!_ |
| 76 | + _Automated development build from commit ${{ steps.commit.outputs.hash }}._ |
| 77 | + loaders: velocity |
| 78 | + game-versions: '["1.21.x","1.20.x","1.19.x","1.18.x","1.17.x","1.16.x","1.15.x","1.14.x","1.13.x","1.12.x","1.11.x","1.10.x","1.9.x","1.8.x","1.7.x"]' |
| 79 | + files: build/libs/vHubs-${{ steps.version.outputs.dev_version }}.jar |
0 commit comments