Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setup publishing #5

Merged
merged 4 commits into from
Feb 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,6 @@ indent_size = 4
indent_style = space
insert_final_newline = true
max_line_length = off

[*.yml]
indent_size = 2
65 changes: 42 additions & 23 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,27 +1,46 @@
name: Build
on:
push:
branches: [ "**" ]
tags-ignore: [ "**" ]
pull_request:
push:
branches: [ "**" ]
tags-ignore: [ "**" ]
pull_request:

jobs:
build:
# Only run on PRs if the source branch is on someone else's repo
if: ${{ github.event_name != 'pull_request' || github.repository != github.event.pull_request.head.repo.full_name }}
runs-on: ubuntu-latest
strategy:
matrix:
java: [ 17 ]
fail-fast: true
steps:
- uses: actions/checkout@v4
- uses: gradle/wrapper-validation-action@v2
- name: JDK ${{ matrix.java }}
uses: actions/setup-java@v4
with:
java-version: ${{ matrix.java }}
distribution: 'temurin'
- uses: gradle/actions/setup-gradle@v3
- name: Build
run: ./gradlew build --stacktrace
build:
# Only run on PRs if the source branch is on someone else's repo
if: ${{ github.event_name != 'pull_request' || github.repository != github.event.pull_request.head.repo.full_name }}
runs-on: ubuntu-latest
strategy:
matrix:
java: [ 17 ]
fail-fast: true
steps:
- uses: actions/checkout@v4
- uses: gradle/wrapper-validation-action@v2
- name: JDK ${{ matrix.java }}
uses: actions/setup-java@v4
with:
java-version: ${{ matrix.java }}
distribution: 'temurin'
- uses: gradle/actions/setup-gradle@v3
- name: Build
run: ./gradlew build --stacktrace
- name: Determine Status
run: |
if [ "$(./gradlew properties | awk '/^version:/ { print $2; }' | grep '\-SNAPSHOT')" ]; then
echo "STATUS=snapshot" >> $GITHUB_ENV
else
echo "STATUS=release" >> $GITHUB_ENV
fi
- name: Publish Snapshot
if: "${{ env.STATUS != 'release' && github.event_name == 'push' && github.ref == 'refs/heads/main' }}"
run: ./gradlew publish
env:
ORG_GRADLE_PROJECT_paperUsername: "${{ secrets.PAPER_REPO_USER }}"
ORG_GRADLE_PROJECT_paperPassword: "${{ secrets.PAPER_REPO_PASSWORD }}"
- name: Publish Release
if: "${{ env.STATUS == 'release' && github.event_name == 'release' }}"
run: ./gradlew publish
env:
ORG_GRADLE_PROJECT_paperUsername: "${{ secrets.PAPER_REPO_USER }}"
ORG_GRADLE_PROJECT_paperPassword: "${{ secrets.PAPER_REPO_PASSWORD }}"
30 changes: 30 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
import org.incendo.cloudbuildlogic.jmp

plugins {
val indraVer = "3.1.3"
id("net.kyori.indra") version indraVer
id("net.kyori.indra.checkstyle") version indraVer
id("net.kyori.indra.publishing") version indraVer
id("org.incendo.cloud-build-logic.javadoc-links") version "0.0.12"
}

allprojects {
Expand All @@ -14,6 +17,33 @@ allprojects {
javaVersions {
target(17)
}

publishSnapshotsTo("paperSnapshots", "https://repo.papermc.io/repository/maven-snapshots/")
publishReleasesTo("paperReleases", "https://repo.papermc.io/repository/maven-releases/")

apache2License()

github("PaperMC", "asm-utils") {
ci(true)
}

configurePublications {
pom {
developers {
jmp()
developer {
id = "Machine-Maker"
name = "Jake Potrebic"
url = "https://github.com/Machine-Maker"
}
developer {
id = "kennytv"
name = "Nassim Jahnke"
url = "https://github.com/kennytv"
}
}
}
}
}

repositories {
Expand Down
1 change: 1 addition & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# project meta
group=io.papermc
version=0.0.1-SNAPSHOT
description=Shared ASM utilities for PaperMC projects

# gradle options
org.gradle.caching=true
Expand Down