Skip to content

Commit

Permalink
Testing (#1)
Browse files Browse the repository at this point in the history
* improve building

Signed-off-by: Valentin Sickert <[email protected]>

* start test

Signed-off-by: Valentin Sickert <[email protected]>

* add checkout

Signed-off-by: Valentin Sickert <[email protected]>

* set api version

Signed-off-by: Valentin Sickert <[email protected]>

* remove dynamic version

Signed-off-by: Valentin Sickert <[email protected]>

* set correct version via comment

Signed-off-by: Valentin Sickert <[email protected]>

* update workflow because `::set-output` is deprecated

Signed-off-by: Valentin Sickert <[email protected]>

* test empty dispatch

Signed-off-by: Valentin Sickert <[email protected]>

---------

Signed-off-by: Valentin Sickert <[email protected]>
  • Loading branch information
Lapotor authored Jan 10, 2024
1 parent d06030d commit 57fe4c8
Show file tree
Hide file tree
Showing 4 changed files with 88 additions and 20 deletions.
44 changes: 26 additions & 18 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,31 +1,39 @@
name: Core-API | Maven-deployer

# This workflow is used to deploy a new maven-build of this api, whenever a new release is created.
# Always make sure to delete the latest package before creating a new release!
name: Core-API | Build and deploy

on:
release: # Triggers this workflow whenever a new release is created.
type: [published]
workflow_call:
inputs:
version:
description: 'The version of the new build.'
required: true
type: string

permissions:
contents: read
packages: write

jobs:
build:
runs-on: ubuntu-latest

steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it.
- name: Repository-Checkout
uses: actions/checkout@v2
- name: Checkout
uses: actions/checkout@v4

# Sets the current Java-version to 1.8.
- name: Set up to JDK 1.8
uses: actions/setup-java@v1
uses: actions/setup-java@v4
with:
java-version: 1.8.0
distribution: 'temurin'
cache: 'maven'
java-version: 8

- name: Set Project Version
run: mvn versions:set -DnewVersion=${{ inputs.version }}

- name: Build with Maven
run: mvn source:jar

# Deploys a maven-build as a new package to be accessed with any pom.xml.
- name: Deploy to GitHub
run: |
mvn source:jar
mvn deploy
- name: Deploy to GitHub Packages # Repository is set in pom.xml
run: mvn deploy
env:
GITHUB_TOKEN: ${{ secrets.DEPLOY_GITHUB_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
33 changes: 33 additions & 0 deletions .github/workflows/nightly-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Core-API | Nightly Builder

on:
push:
branches:
- testing

workflow_dispatch:

jobs:
get-version:
name: Get version
runs-on: ubuntu-latest
outputs:
version: ${{ steps.set-version-push.outputs.version || steps.set-version.outputs.version }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set short commit hash on push
if: github.event_name == 'push'
id: set-version-push
run: echo "version=$(git rev-parse --short HEAD)" >> "$GITHUB_OUTPUT"
- name: Set version from input
if: github.event_name == 'workflow_dispatch'
id: set-version
run: echo "version=${{ github.event.inputs.version }}" >> "$GITHUB_OUTPUT"

build-nightly:
name: Build Nightly version
needs: get-version
uses: ./.github/workflows/build.yml
with:
version: ${{ needs.get-version.outputs.version }}
27 changes: 27 additions & 0 deletions .github/workflows/release-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Core-API | Release Builder

on:
release:
types: [published]

jobs:
get-version:
name: Get Version
runs-on: ubuntu-latest
outputs:
version: ${{ steps.get-version.outputs.version }}
steps:
- name: Get Version
id: get-version
run: |
TAG_NAME=${{ github.event.release.tag_name }}
echo "version=${TAG_NAME#v}" >> "$GITHUB_OUTPUT"
build-release:
name: Build Release
needs: get-version
uses: ./.github/workflows/build.yml
with:
version: ${{ needs.get-version.outputs.version }}


4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>minevalley.core</groupId>
<artifactId>api</artifactId>
<version>1.278</version>
<version>nightly</version>
<packaging>jar</packaging>

<build>
Expand All @@ -31,7 +31,7 @@
<repository>
<id>github</id>
<name>GitHub MineValley Apache Maven Packages</name>
<url>https://maven.pkg.github.com/MineValley/Core-API</url>
<url>https://maven.pkg.github.com/Lapotor/Core-API</url>
</repository>
</distributionManagement>

Expand Down

0 comments on commit 57fe4c8

Please sign in to comment.