Skip to content

Commit

Permalink
Merge branch 'master' into production
Browse files Browse the repository at this point in the history
  • Loading branch information
hjwilli committed Oct 6, 2022
2 parents 3aab81d + 605b6ee commit d4bb8d8
Show file tree
Hide file tree
Showing 10 changed files with 96 additions and 71 deletions.
7 changes: 4 additions & 3 deletions .env-template
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
#.env is only used in the docker-compose files

#
SIGNING_PRIVATE_KEY=
SIGNING_PRIVATE_KEY_PASSWORD=
SIGNING_KEY_ID=
SIGNING_PRIVATE_DIR=
SIGNING_PRIVATE_FILE= # must be .gpg format
SIGNING_PRIVATE_KEY_PASSWORD=
SIGNING_KEY_ID= # usually last 8 of fingerprint

#
CENTRAL_USER=
Expand Down
12 changes: 1 addition & 11 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -76,17 +76,6 @@ allprojects {
subprojects {
apply plugin: 'groovy'

apply plugin: "signing"
//ext.isReleaseVersion = !version.endsWith("SNAPSHOT")
signing {
required {
//isReleaseVersion &&
gradle.taskGraph.hasTask("publish") &&
!gradle.taskGraph.hasTask("publishToMavenLocal")
}
sign publishing.publications
}

dependencies {
// see gradle.properties for versions

Expand Down Expand Up @@ -148,6 +137,7 @@ subprojects {
///////////////////////////////////////////////////////////////////////////////
subprojects {
apply plugin: "maven-publish"
apply plugin: "signing"
publishing {
repositories {
maven {
Expand Down
28 changes: 11 additions & 17 deletions app/carnival-core/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -61,26 +61,20 @@ publishing {
url 'https://github.com/carnival-data/carnival'
}
}
}
//pom.withXml {
// Node pomNode = asNode()
// pomNode.dependencies.'*'.findAll() {
// it.artifactId.text() == 'ojdbc6'
// }.each() {
// it.parent().remove(it)
// }
//}
}
}
}
repositories {
maven {
// mavenCentral {
// change URLs to point to your repos, e.g. http://my.org/repo
def releasesRepoUrl = "$buildDir/repos/releases"
def snapshotsRepoUrl = "$buildDir/repos/snapshots"
url = version.endsWith('SNAPSHOT') ? snapshotsRepoUrl : releasesRepoUrl
}
}


signing {
required {
(!version.endsWith("SNAPSHOT")) &&
gradle.taskGraph.hasTask("publish") &&
!gradle.taskGraph.hasTask("publishToMavenLocal")
}

sign publishing.publications.mavenGroovy
}


Expand Down
17 changes: 10 additions & 7 deletions app/carnival-gradle/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -72,18 +72,21 @@ publishing {
}
}
}
repositories {
maven {
// change URLs to point to your repos, e.g. http://my.org/repo
def releasesRepoUrl = "$buildDir/repos/releases"
def snapshotsRepoUrl = "$buildDir/repos/snapshots"
url = version.endsWith('SNAPSHOT') ? snapshotsRepoUrl : releasesRepoUrl
}
}

signing {
required {
(!version.endsWith("SNAPSHOT")) &&
gradle.taskGraph.hasTask("publish") &&
!gradle.taskGraph.hasTask("publishToMavenLocal")
}

sign publishing.publications.mavenGroovy
}




///////////////////////////////////////////////////////////////////////////////
// dependencies
///////////////////////////////////////////////////////////////////////////////
Expand Down
17 changes: 10 additions & 7 deletions app/carnival-graph/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -68,18 +68,21 @@ publishing {
}
}
}
repositories {
maven {
// change URLs to point to your repos, e.g. http://my.org/repo
def releasesRepoUrl = "$buildDir/repos/releases"
def snapshotsRepoUrl = "$buildDir/repos/snapshots"
url = version.endsWith('SNAPSHOT') ? snapshotsRepoUrl : releasesRepoUrl
}
}

signing {
required {
(!version.endsWith("SNAPSHOT")) &&
gradle.taskGraph.hasTask("publish") &&
!gradle.taskGraph.hasTask("publishToMavenLocal")
}

sign publishing.publications.mavenGroovy
}




///////////////////////////////////////////////////////////////////////////////
// dependencies
///////////////////////////////////////////////////////////////////////////////
Expand Down
16 changes: 9 additions & 7 deletions app/carnival-util/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -68,14 +68,16 @@ publishing {
}
}
}
repositories {
maven {
// change URLs to point to your repos, e.g. http://my.org/repo
def releasesRepoUrl = "$buildDir/repos/releases"
def snapshotsRepoUrl = "$buildDir/repos/snapshots"
url = version.endsWith('SNAPSHOT') ? snapshotsRepoUrl : releasesRepoUrl
}
}

signing {
required {
(!version.endsWith("SNAPSHOT")) &&
gradle.taskGraph.hasTask("publish") &&
!gradle.taskGraph.hasTask("publishToMavenLocal")
}

sign publishing.publications.mavenGroovy
}


Expand Down
6 changes: 3 additions & 3 deletions docker-compose-publish-maven.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@ services:
working_dir: /appsrc/app
command: >
gradle publishAllPublicationsToCentralRepository
-Psigning.secretKeyRingFile=/appsrc/signing_private.gpg
-Psigning.secretKeyRingFile=/appsrc/keys/${SIGNING_PRIVATE_FILE}
-Psigning.password=${SIGNING_PRIVATE_KEY_PASSWORD}
-Psigning.keyId=${SIGNING_KEY_ID}
-Pcentral.user=${CENTRAL_USER}
-Pcentral.password=${CENTRAL_PASSWORD}
--no-daemon
--no-daemon --console=plain
tty: true
stdin_open: true
volumes:
- ./:/appsrc
- ${SIGNING_PRIVATE_KEY}:/appsrc/signing_private.gpg
- ${SIGNING_PRIVATE_DIR}:/appsrc/keys
2 changes: 1 addition & 1 deletion docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ To learn more about graph methods, see [Graph Methods](graph-method.md).

## <a name="core-development"></a>Core Development
- [Developer Setup](developer-setup.md)
- [Production Builds](production-buids.md)
- [Production Builds](production-builds.md)
- [Building Documentation](documentation.md)
- [Default Carnival Schemas](schema.md)

Expand Down
15 changes: 0 additions & 15 deletions docs/production-buids.md

This file was deleted.

47 changes: 47 additions & 0 deletions docs/production-builds.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# Production Builds

## Publishing to Maven

* Maven Repository Manager: https://s01.oss.sonatype.org/#welcome
* Maven: https://search.maven.org/artifact/io.github.carnival-data/carnival-core

### Configuration
Copy `.env-template` to `.env` and update the file with your maven central credentials and private key information. The signing file should be .gpg format, and SIGNING_KEY_ID is usually the last 8 digits of the fingerprint. More detail about the signing plugin available [here](https://docs.gradle.org/7.4.1/userguide/signing_plugin.html#sec:signatory_credentials).


### Publish to Snapshot Repository
When the carnivalVersion specified in `app\gradle.properties` ends with "-SNAPSHOT", the package will be published to the snapshot repository. Previous releases with the same version can be overwritten.
```
docker-compose -f docker-compose-publish-maven.yml up
```

### Publish Release Versions
If the version number does not end with "-SNAPSHOT", the package will be published to the staging repository and must be manually approved.

1. Run the following to publish to the staging repository:
```
docker-compose -f docker-compose-publish-maven.yml up
```

1. Log into the [Maven Nexus Repository Manager](https://s01.oss.sonatype.org/#welcome)

1. Click "Staging Repositories" on the left. The repository that was just published should be visible.

1. Review the repository files. If it looks correct, click "close" to close the staging repository and start the validation process.

1. If the validation is successfull, click "Release" to publish the release.


### Publishing Production Builds to Github (Deprecated)

Production images are published to Github packages. In order to publish an image, you will need to create a Github personal access token with appropriate permissions to manage github packages (see Github Packages documentation for details). Then create local environment variables **GITHUB_USER** and **GITHUB_TOKEN** with your github user and personal access token.
Once authorization has been set up, the procedure to publish production builds is:

- Stage and test any changes in the master branch
- Update the app version number in `app/build.gradle` using semantic versioning conventions
- Merge changes into the production branch
- Build and publish changes to Github with the command gradle publish . The build.grade file has been configured to use the authentication information in the environment variables **GITHUB_USER** and **GITHUB_TOKEN** when attempting to publish.
- Check that the packages with the updated version number are listed in Carnival Packages
- Go back to the master branch, and `app/build.gradle` increment the version number and add the `-SNAPSHOT` suffix (i.e. `0.2.9-SNAPSHOT`)

For further details, see Configuring Gradle for use with GitHub Packages.

0 comments on commit d4bb8d8

Please sign in to comment.