Publish #43
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: Publish | |
on: | |
workflow_dispatch: | |
jobs: | |
github: | |
name: "GitHub" | |
runs-on: ubuntu-latest | |
outputs: | |
version: "${{ steps.setup.outputs.version }}" | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v4 | |
with: | |
fetch-tags: true | |
fetch-depth: 0 | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v4 | |
with: | |
java-version: 17 | |
distribution: "temurin" | |
- name: Setup Gradle | |
uses: gradle/actions/setup-gradle@v4 | |
- name: Build Artifacts | |
run: gradle build | |
- name: Upload Test Summary | |
uses: EnricoMi/publish-unit-test-result-action@v2 | |
if : always() | |
with: | |
check_name: "test results" | |
junit_files: "**/build/test-results/test/TEST-*.xml" | |
- name: Set up Artifacts Upload | |
id: setup | |
run: | | |
echo "MINDUSTRY_ARTIFACT_PATH=$(gradle :imperium-mindustry:getArtifactPath -q)" >> $GITHUB_ENV | |
echo "DISCORD_ARTIFACT_PATH=$(gradle :imperium-discord:getArtifactPath -q)" >> $GITHUB_ENV | |
echo "version=$(gradle printVersion -q)" >> $GITHUB_OUTPUT | |
- name: Upload Artifacts to Release | |
uses: softprops/action-gh-release@v2 | |
with: | |
name: "Build v${{ steps.setup.outputs.version }}" | |
tag_name: "v${{ steps.setup.outputs.version }}" | |
files: | | |
${{ env.MINDUSTRY_ARTIFACT_PATH }} | |
${{ env.DISCORD_ARTIFACT_PATH }} | |
- name: Increment Version | |
run: gradle incrementVersionFile | |
- name: Commit Incremented Version | |
uses: stefanzweifel/git-auto-commit-action@v5 | |
with: | |
branch: "${{ github.event.release.target_commitish }}" | |
commit_message: "chore: Increment version" | |
file_pattern: VERSION.txt | |
maven: | |
name: "Maven" | |
runs-on: ubuntu-latest | |
needs: [ github ] | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v4 | |
with: | |
ref: "refs/tags/v${{ needs.github.outputs.version }}" | |
fetch-tags: true | |
fetch-depth: 0 | |
- name: Validate Gradle Wrapper | |
uses: gradle/actions/wrapper-validation@v4 | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v4 | |
with: | |
java-version: 17 | |
distribution: "temurin" | |
cache: "gradle" | |
- name: Publish Artifacts | |
run: gradle publish | |
env: | |
ORG_GRADLE_PROJECT_xpdustryUsername: "${{ secrets.XPDUSTRY_MAVEN_USERNAME }}" | |
ORG_GRADLE_PROJECT_xpdustryPassword: "${{ secrets.XPDUSTRY_MAVEN_PASSWORD }}" | |
ORG_GRADLE_PROJECT_signingKey: "${{ secrets.XPDUSTRY_MAVEN_SIGNING_KEY }}" | |
ORG_GRADLE_PROJECT_signingPassword: "${{ secrets.XPDUSTRY_MAVEN_SIGNING_PASSWORD }}" |