diff --git a/.github/workflows/buildOnRelease.properties.json b/.github/workflows/buildOnRelease.properties.json new file mode 100644 index 0000000..afd5762 --- /dev/null +++ b/.github/workflows/buildOnRelease.properties.json @@ -0,0 +1,6 @@ +{ + "name": "Build project on release", + "description": "Builds and exports project as .jar file when a new github release is made", + "iconName": "maven", + "categories": ["Continuous integration", "Java", "Maven"] +} diff --git a/.github/workflows/buildOnRelease.yml b/.github/workflows/buildOnRelease.yml new file mode 100644 index 0000000..46443fa --- /dev/null +++ b/.github/workflows/buildOnRelease.yml @@ -0,0 +1,33 @@ +name: Build and Attach Release JAR + +on: + release: + types: [created] + workflow_dispatch: + +jobs: + build: + runs-on: [self-hosted] + + + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-java@v4 + with: + distribution: temurin + java-version: '25' + cache: maven + + - run: mvn clean package + + - name: Set versioned JAR name + run: echo "JAR_NAME=APPLICATION-${GITHUB_REF#refs/tags/}.jar" >> $GITHUB_ENV + + - name: Rename JAR + run: mv target/*.jar $JAR_NAME + + - uses: softprops/action-gh-release@v1 + with: + files: ${{ env.JAR_NAME }} + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/main.properties.json b/.github/workflows/tests.properties.json similarity index 100% rename from .github/workflows/main.properties.json rename to .github/workflows/tests.properties.json diff --git a/.github/workflows/main.yml b/.github/workflows/tests.yml similarity index 100% rename from .github/workflows/main.yml rename to .github/workflows/tests.yml