Implement snapshot and release publishing

This commit is contained in:
Kyle Wood 2021-06-14 23:49:52 -05:00
parent cfcb0ef378
commit ed900662d2
No known key found for this signature in database
GPG key ID: 86AF5613ACA30CC5
4 changed files with 77 additions and 19 deletions

44
.github/workflows/deploy-snapshot.yml vendored Normal file
View file

@ -0,0 +1,44 @@
name: Deploy Snapshot
on:
push:
branches: ['main']
paths-ignore:
- 'license/*'
- 'readme.md'
- '.gitignore'
- '.gitattributes'
- '.editorconfig'
jobs:
deploy:
name: Deploy
runs-on: 'ubuntu-latest'
steps:
- uses: actions/checkout@v2
- uses: gradle/wrapper-validation-action@v1
- uses: actions/setup-java@v2
with:
java-version: 16
distribution: 'adopt'
- uses: actions/cache@v2
with:
path: |
~/.gradle/caches
~/.gradle/jdks
~/.gradle/native
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Get project version
id: get_version
shell: bash
run: |
project_version=$(./gradlew -q --console=plain printVersion --no-daemon)
echo ::set-output name=version::$project_version
- name: Deploy snapshot version
if: endsWith(steps.get_version.outputs.version, '-SNAPSHOT')
run: ./gradlew -Dorg.gradle.parallel=true publish --no-daemon --stacktrace
env:
ORG_GRADLE_PROJECT_paperUsername: ${{ secrets.DEPLOY_USER }}
ORG_GRADLE_PROJECT_paperPassword: ${{ secrets.DEPLOY_PASS }}

View file

@ -1,16 +1,19 @@
name: Deploy
on:
push:
branches:
- main
tags: ['v*']
jobs:
deploy:
runs-on: ubuntu-20.04
container:
image: adoptopenjdk:11-jdk-hotspot-focal
options: --user root
name: Deploy
runs-on: 'ubuntu-latest'
steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v2
- uses: gradle/wrapper-validation-action@v1
- uses: actions/setup-java@v2
with:
java-version: 16
distribution: 'adopt'
- uses: actions/cache@v2
with:
path: |
@ -21,8 +24,7 @@ jobs:
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }}
restore-keys: |
${{ runner.os }}-gradle-
- uses: gradle/wrapper-validation-action@v1
- run: ./gradlew publish --no-daemon --stacktrace
- run: ./gradlew -Dorg.gradle.parallel=true publish --no-daemon --stacktrace
env:
ORG_GRADLE_PROJECT_paperUsername: ${{ secrets.DEPLOY_USER }}
ORG_GRADLE_PROJECT_paperPassword: ${{ secrets.DEPLOY_PASS }}

View file

@ -1,13 +1,21 @@
name: Build
on: [push, pull_request]
name: Test
on:
push:
branches: ['*']
pull_request:
branches: ['*']
jobs:
build:
runs-on: ubuntu-20.04
container:
image: adoptopenjdk:11-jdk-hotspot-focal
options: --user root
test:
name: Test
runs-on: 'ubuntu-latest'
steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v2
- uses: gradle/wrapper-validation-action@v1
- uses: actions/setup-java@v2
with:
java-version: 16
distribution: 'adopt'
- uses: actions/cache@v2
with:
path: |
@ -18,5 +26,4 @@ jobs:
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }}
restore-keys: |
${{ runner.os }}-gradle-
- uses: gradle/wrapper-validation-action@v1
- run: ./gradlew build --no-daemon --stacktrace
- run: ./gradlew -Dorg.gradle.parallel=true build --no-daemon --stacktrace

5
build.gradle.kts Normal file
View file

@ -0,0 +1,5 @@
tasks.register("printVersion") {
doFirst {
println(version)
}
}