Skip to content

Commit

Permalink
chore: mmmh
Browse files Browse the repository at this point in the history
  • Loading branch information
phinner committed Dec 10, 2023
1 parent f56e8c0 commit c2cb35a
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 44 deletions.
94 changes: 52 additions & 42 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,16 @@
name: Build

on: [ push, pull_request ]
on:
push:
branches: [ "**" ]
tags-ignore: [ "**" ]
pull_request:
release:
types: [ released ]

concurrency:
group: ${{ github.workflow }}-${{ github.event.number || github.ref }}
cancel-in-progress: true

jobs:
build:
Expand All @@ -10,24 +20,31 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v1
- name: Checkout Repository
uses: actions/checkout@v3

- name: Validate Gradle Wrapper
uses: gradle/wrapper-validation-action@v1

- name: Set up JDK 17
uses: actions/setup-java@v2
uses: actions/setup-java@v3
with:
java-version: 17
distribution: 'temurin'
cache: 'gradle'

- uses: gradle/wrapper-validation-action@v1
- name: Build Artifact
run: ./gradlew build

- name: Setup Gradle
uses: gradle/gradle-build-action@v2
- name: Set up Artifact Upload
id: upload
run: echo "ARTIFACT_PATH=$(./gradlew getArtifactPath -q)" >> $GITHUB_ENV

- name: Build artifact
id: build
run: |
./gradlew build
echo '::set-output name=ARTIFACT_PATH::'$(./gradlew getArtifactPath -q)
- name: Upload Artifact to Actions
uses: actions/upload-artifact@v3
with:
name: ${{ github.event.repository.name }}
path: ${{ env.ARTIFACT_PATH }}

- name: Determine Status
run: |
Expand All @@ -37,42 +54,35 @@ jobs:
echo "STATUS=release" >> $GITHUB_ENV
fi
- name: Set up Release
if: "${{ env.STATUS == 'release' }}"
id: release
run: |
tag=$(cat plugin.json | grep "version*") # Cut the line with the version in plugin.json
tag=$(echo $tag | cut -d ":" -f 2,3) # Split with ":" and take the version number
tag=$(echo $tag | tr -d \"," ") # Trim the " and , and spaces
echo '::set-output name=RELEASE_TAG::'$tag
r=$(cat CHANGELOG.md)
r="${r//'%'/'%25'}" # Multiline escape sequences for %
r="${r//$'\n'/'%0A'}" # Multiline escape sequences for '\n'
r="${r//$'\r'/'%0D'}" # Multiline escape sequences for '\r'
echo "::set-output name=CHANGELOG::$r"
- name: Publish to Xpdustry
if: ${{ env.STATUS == 'release' || startsWith(github.ref, 'refs/heads/master') }}
run: ./gradlew 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 }}"

- name: Upload artifact to Release
if: "${{ env.STATUS == 'release' }}"
- name: Upload Artifact to Release
if: ${{ env.STATUS == 'release' && github.event_name == 'release' }}
uses: svenstaro/upload-release-action@v2
with:
release_name: v${{ steps.release.outputs.RELEASE_TAG }} release
body: ${{ steps.release.outputs.CHANGELOG }}

repo_token: ${{ secrets.GITHUB_TOKEN }}
asset_name: ${{ github.event.repository.name }}.jar
file: ${{ steps.build.outputs.ARTIFACT_PATH }}
tag: v${{ steps.release.outputs.RELEASE_TAG }}
file: ${{ env.ARTIFACT_PATH }}
tag: ${{ github.ref }}

- name: Upload artifact to Actions
uses: actions/upload-artifact@v2
- name: Update Changelog
if: ${{ env.STATUS == 'release' && github.event_name == 'release' }}
uses: stefanzweifel/changelog-updater-action@v1
with:
name: ${{ github.event.repository.name }}
path: ${{ steps.build.outputs.ARTIFACT_PATH }}
latest-version: ${{ github.event.release.tag_name }}
release-notes: ${{ github.event.release.body }}

- name: Publish to Omega repo (private)
if: ${{ github.event_name != 'pull_request' }}
run: ./gradlew publish
env:
ORG_GRADLE_PROJECT_omegaUsername: "${{ secrets.OMEGA_REPO_USERNAME }}"
ORG_GRADLE_PROJECT_omegaPassword: "${{ secrets.OMEGA_REPO_PASSWORD }}"
- name: Commit Updated Changelog
if: ${{ env.STATUS == 'release' && github.event_name == 'release' }}
uses: stefanzweifel/git-auto-commit-action@v4
with:
branch: ${{ github.event.release.target_commitish }}
commit_message: Update CHANGELOG
file_pattern: CHANGELOG.md
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# OmegaLeaderboardPlugin

[![Build](https://github.com/Xpdustry/OmegaLeaderboardPlugin/actions/workflows/build.yml/badge.svg)](https://github.com/Xpdustry/OmegaLeaderboardPlugin/actions/workflows/build.yml)
[![Mindustry 6.0 | 7.0 ](https://img.shields.io/badge/Mindustry-6.0%20%7C%207.0-ffd37f)](https://github.com/Anuken/Mindustry/releases)
[![Build](https://github.com/xpdustry/leaderboard/actions/workflows/build.yml/badge.svg)](https://github.com/Xpdustry/OmegaLeaderboardPlugin/actions/workflows/build.yml)
[![Mindustry 7.0 ](https://img.shields.io/badge/Mindustry-7.0-ffd37f)](https://github.com/Anuken/Mindustry/releases)

## Description

Expand Down

0 comments on commit c2cb35a

Please sign in to comment.