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

Move build artifacts to GitHub Packages #146

Merged
merged 10 commits into from
Nov 18, 2023
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
17 changes: 10 additions & 7 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,35 +11,38 @@ jobs:
with:
github_token: ${{ secrets.github_token }}
detekt_config: .detekt.yml
Build:
CI:
runs-on: ubuntu-latest
permissions:
id-token: write
contents: read
checks: write
packages: write
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Java
uses: actions/setup-java@v3
with:
distribution: zulu
java-version: 18
java-version: 20
- name: Start Supporting Services
run: ./scripts/setup.sh
- name: Build & Deploy
uses: gradle/gradle-build-action@v2
uses: gradle/gradle-build-action@v2.4.2
env:
ARTIFACTORY_USER: ${{ secrets.ARTIFACTORY_USER }}
ARTIFACTORY_PASSWORD: ${{ secrets.ARTIFACTORY_PASSWORD }}
PACKAGE_STORE_USERNAME: ${{ secrets.PACKAGE_STORE_USERNAME }}
PACKAGE_STORE_TOKEN: ${{ secrets.PACKAGE_STORE_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
DB_URL: ${{ secrets.DB_URL }}
with:
gradle-version: 7.6
arguments: clean test build artifactoryPublish --info -PIS_SNAPSHOT_BUILD=true
gradle-version: 8.2.1
arguments: clean test build publish --info --stacktrace -PIS_SNAPSHOT_BUILD=true
- name: Upload Test Results
uses: dorny/[email protected]
if: success() || failure()
with:
name: Test Results
path: build/test-results/test/*.xml
reporter: java-junit

16 changes: 9 additions & 7 deletions .github/workflows/cicd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,31 +4,33 @@ on:
tags:
- '*'
jobs:
Build:
CI-CD:
runs-on: ubuntu-latest
permissions:
id-token: write
contents: read
checks: write
packages: write
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Java
uses: actions/setup-java@v3
with:
distribution: zulu
java-version: 18
java-version: 20
- name: Start Supporting Services
run: ./scripts/setup.sh
- name: Build & Deploy
uses: gradle/gradle-build-action@v2
uses: gradle/gradle-build-action@v2.4.2
env:
ARTIFACTORY_USER: ${{ secrets.ARTIFACTORY_USER }}
ARTIFACTORY_PASSWORD: ${{ secrets.ARTIFACTORY_PASSWORD }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PACKAGE_STORE_USERNAME: ${{ secrets.PACKAGE_STORE_USERNAME }}
PACKAGE_STORE_TOKEN: ${{ secrets.PACKAGE_STORE_TOKEN }}
DB_URL: ${{ secrets.DB_URL }}
with:
gradle-version: 7.6
arguments: clean test build artifactoryPublish --info -PIS_SNAPSHOT_BUILD=false
gradle-version: 8.2.1
arguments: clean test build publish --info --stacktrace -PIS_SNAPSHOT_BUILD=false
- name: Upload Test Results
uses: dorny/[email protected]
if: success() || failure()
Expand Down
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

# 0.12.2

- `jdk` version `20`
- `jvm` version `1.9.0`
- Moved build artifacts to GitHub Packages

# 0.12.1

- `jdk` version `18`
Expand Down
76 changes: 37 additions & 39 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,27 +1,31 @@
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
import org.jfrog.gradle.plugin.artifactory.dsl.PublisherConfig
import org.jfrog.gradle.plugin.artifactory.dsl.ResolverConfig
import groovy.lang.GroovyObject

plugins {
kotlin("jvm") version "1.8.21"
id("com.jfrog.artifactory") version "4.32.0"
id("org.jetbrains.dokka") version "1.8.10"
kotlin("jvm") version "1.9.0"
id("org.jetbrains.dokka") version "1.8.20"
id("maven-publish")
idea
}

group = "io.taff"
version = "0.12.1${ if (isReleaseBuild()) "" else "-SNAPSHOT" }"
java.sourceCompatibility = JavaVersion.VERSION_18
version = "0.12.2${ if (isReleaseBuild()) "" else "-SNAPSHOT" }"
java.sourceCompatibility = JavaVersion.VERSION_20

repositories {
maven {
name = "JFrog"
url = uri("https://tmpasipanodya.jfrog.io/artifactory/releases")
name = "spek-expect"
url = uri("https://maven.pkg.github.com/tpasipanodya/exposed")
credentials {
username = System.getenv("ARTIFACTORY_USER")
password = System.getenv("ARTIFACTORY_PASSWORD")
username = System.getenv("PACKAGE_STORE_USERNAME")
password = System.getenv("PACKAGE_STORE_TOKEN")
}
}
maven {
name = "spek-expect"
url = uri("https://maven.pkg.github.com/tpasipanodya/spek-expekt")
credentials {
username = System.getenv("PACKAGE_STORE_USERNAME")
password = System.getenv("PACKAGE_STORE_TOKEN")
}
}
mavenCentral()
Expand All @@ -37,18 +41,18 @@ dependencies {
api("org.slf4j:slf4j-simple:2.0.7")
api("com.fasterxml.jackson.module:jackson-module-kotlin:2.15.2")
api("com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.15.2")
api("io.taff.exposed:exposed-core:0.8.1")
api("io.taff.exposed:exposed-jdbc:0.8.1")
api("io.taff.exposed:exposed-java-time:0.8.1")
api("io.taff.exposed:exposed-core:0.9.2")
api("io.taff.exposed:exposed-jdbc:0.9.2")
api("io.taff.exposed:exposed-java-time:0.9.2")
implementation("org.postgresql:postgresql:42.6.0")
testImplementation("io.taff:spek-expekt:0.9.0")
testImplementation("io.taff:spek-expekt:0.10.3")
testImplementation(enforcedPlatform("org.junit:junit-bom:5.9.3"))
}

tasks.withType<KotlinCompile> {
kotlinOptions {
freeCompilerArgs = listOf("-Xjsr305=strict")
jvmTarget = "18"
jvmTarget = "20"
}
}

Expand All @@ -67,67 +71,61 @@ tasks {
tasks.withType<Test> { useJUnitPlatform() }

publishing {
repositories {
maven {
name = "GitHubPackages"
url = uri("https://maven.pkg.github.com/tpasipanodya/exposed-extensions")
credentials {
username = System.getenv("GITHUB_ACTOR")
password = System.getenv("GITHUB_TOKEN")
}
}
}
publications {
create<MavenPublication>("mavenJava") {
this.groupId = project.group.toString()
this.artifactId = project.name
this.version = project.version.toString()
from(components["java"])

versionMapping {
usage("java-api") {
fromResolutionOf("runtimeClasspath")
}
}

artifact(tasks["dokkaJar"])
artifact(tasks["sourcesJar"])

pom {
name.set(project.name)
description.set("${project.name} $version - Lightweight utilities for simplifying backend application configuration")
url.set("https://github.com/tpasipanodya/exposed-extensions")

licenses {
license {
name.set("The Apache Software License, Version 2.0")
url.set("http://www.apache.org/licenses/LICENSE-2.0.txt")
}
}

developers {
developer {
name.set("Tafadzwa Pasipanodya")
email.set("[email protected]")
}
}

scm {
connection.set("scm:git:git://github.com/tpasipanodya/exposed-extensions.git")
developerConnection.set("scm:git:ssh://github.com/tpasipanodya/exposed-extensions.git")
url.set("http://github.com/tpasipanodya/exposed-extensions/tree/main")
}
}

}
}
}


artifactory {
setContextUrl("https://tmpasipanodya.jfrog.io/artifactory/")
publish(delegateClosureOf<PublisherConfig> {

repository(delegateClosureOf<GroovyObject> {
setProperty("repoKey", if (isReleaseBuild()) "releases" else "snapshots")
setProperty("username", System.getenv("ARTIFACTORY_USER"))
setProperty("password", System.getenv("ARTIFACTORY_PASSWORD"))
setProperty("maven", true)
})

defaults(delegateClosureOf<GroovyObject> {
invokeMethod("publications", "mavenJava")
})
})
resolve(delegateClosureOf<ResolverConfig> {
setProperty("repoKey", if (isReleaseBuild()) "releases" else "snapshots")
})
}

fun isReleaseBuild() = !project.properties["IS_SNAPSHOT_BUILD"].let { isReleaseBuild ->
println("isReleaseBuild: $isReleaseBuild")
isReleaseBuild.toString().toBoolean()
Expand Down