Build Beta Jars and Publish #166
This file contains hidden or 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: Build Beta Jars and Publish | |
on: | |
workflow_dispatch: | |
permissions: | |
contents: write | |
jobs: | |
build-publish-development: | |
runs-on: ubuntu-latest | |
concurrency: | |
group: build-publish-beta | |
cancel-in-progress: true | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Setup Java | |
uses: actions/setup-java@v4 | |
with: | |
distribution: temurin | |
java-version: 21 | |
- name: Setup Gradle | |
uses: gradle/actions/setup-gradle@v4 | |
with: | |
build-scan-publish: false | |
build-scan-terms-of-use-url: "https://gradle.com/terms-of-service" | |
build-scan-terms-of-use-agree: "yes" | |
cache-cleanup: always | |
- name: Get version | |
id: vars | |
run: | | |
version=$(cat version.txt) | |
run_number=${{ github.run_number }} | |
full_version="${version}-beta-${run_number}" | |
echo $full_version > version.txt | |
echo "version=$full_version" >> $GITHUB_OUTPUT | |
- name: Build Engine | |
uses: ./.github/actions/build-engine | |
# ---------------------------------------------------------------------------------------------------- | |
- name: Test Extensions | |
working-directory: ./extensions | |
run: ./gradlew test --scan | |
# ---------------------------------------------------------------------------------------------------- | |
- name: Publish Engine to Beta Maven Repository | |
working-directory: ./engine | |
env: | |
ORG_GRADLE_PROJECT_TypewriterBetaUsername: ${{ secrets.MAVEN_USERNAME }} | |
ORG_GRADLE_PROJECT_TypewriterBetaPassword: ${{ secrets.MAVEN_PASSWORD }} | |
run: ./gradlew publishAllPublicationsToTypewriterBetaRepository --scan | |
- name: Publish All Extensions to Beta Maven Repository | |
working-directory: ./extensions | |
env: | |
ORG_GRADLE_PROJECT_TypewriterBetaUsername: ${{ secrets.MAVEN_USERNAME }} | |
ORG_GRADLE_PROJECT_TypewriterBetaPassword: ${{ secrets.MAVEN_PASSWORD }} | |
run: ./gradlew publishAllPublicationsToTypewriterBetaRepository --scan | |
- name: Publish Module-Plugin to Beta Maven Repository | |
working-directory: ./module-plugin | |
env: | |
ORG_GRADLE_PROJECT_TypewriterBetaUsername: ${{ secrets.MAVEN_USERNAME }} | |
ORG_GRADLE_PROJECT_TypewriterBetaPassword: ${{ secrets.MAVEN_PASSWORD }} | |
run: ./gradlew publishAllPublicationsToTypewriterBetaRepository --scan | |
# ---------------------------------------------------------------------------------------------------- | |
# Has to be after the publish, because it needs to delete the slim jars and only keep the shadowed jars for the modrinth upload | |
- name: Build Extensions | |
working-directory: ./extensions | |
run: ./gradlew buildRelease --scan | |
# ---------------------------------------------------------------------------------------------------- | |
- name: Publish Modrinth | |
uses: Kir-Antipov/mc-publish@v3.3 | |
id: publish | |
with: | |
modrinth-id: "Vm7B3ymm" | |
modrinth-token: ${{ secrets.MODRINTH_TOKEN }} | |
modrinth-featured: false | |
files: | | |
jars/engine/*.jar | |
jars/extensions/*.jar | |
name: "Typewriter v${{ steps.vars.outputs.version }} Build" | |
version: "${{ steps.vars.outputs.version }}" | |
version-type: "beta" | |
loaders: | | |
paper | |
game-versions: | | |
[1.21.3, 1.21.8] | |
dependencies: | | |
packetevents(required) | |
- name: Publish Hangar | |
working-directory: ./engine | |
continue-on-error: true | |
env: | |
HANGAR_API_TOKEN: ${{ secrets.HANGAR_API_TOKEN }} | |
run: ./gradlew engine-paper:publishPluginPublicationToHangar --scan | |
- name: Add Tag | |
uses: mathieudutour/github-tag-action@v6.2 | |
continue-on-error: true | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
default_bump: false | |
custom_tag: "${{ steps.vars.outputs.version }}" | |
release_branches: develop | |
- name: Notify Discord | |
uses: sarisia/actions-status-discord@v1 | |
with: | |
webhook: ${{ secrets.DISCORD_WEBHOOK }} | |
nodetail: true | |
title: Published Beta Build | |
description: | | |
I have published a beta build of Typewriter. | |
Version: ${{ steps.vars.outputs.version }} | |
[Download](https://modrinth.com/plugin/typewriter/version/${{ steps.publish.outputs.modrinth-version }}) | |
- name: Notify Winston | |
uses: fjogeleit/http-request-action@v1 | |
with: | |
url: 'https://winston-discord-bot.fly.dev/publishbeta' | |
method: 'GET' | |
timeout: 60000 | |
customHeaders: '{"X-Signature": "${{ secrets.WINSTON_SIGNATURE }}"}' |