Skip to content

Commit

Permalink
Fix docs publication (#299)
Browse files Browse the repository at this point in the history
## Task

Resolves: #294 

## Description

None

---------
  • Loading branch information
jplewa authored Aug 29, 2023
1 parent d0d44f1 commit bf102ab
Show file tree
Hide file tree
Showing 3 changed files with 116 additions and 30 deletions.
65 changes: 52 additions & 13 deletions .github/workflows/prepare_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,18 +32,58 @@ jobs:
- name: Push tags
run: git push --tags
publish:
name: Publish packages to Maven Central
name: Publish pulumi-${{ matrix.provider }}-kotlin (${{ matrix.majorVersion }}) to Maven Central Repository
needs: tag
runs-on: [ self-hosted, active ]
if: ${{ needs.tag.outputs.is_release == 'true' }}
strategy:
fail-fast: false
matrix:
provider: [
cloudflare4, cloudflare5, slack0, github5, random4, gcp6, google-native0, aws5, aws-native0, azure5,
azure-native1, azure-native2, kubernetes3, kubernetes4, nomad0, docker3, docker4, gitlab4, gitlab5,
gitlab6, digitalocean4, alicloud3
]
include:
- provider: cloudflare
majorVersion: 4
- provider: cloudflare
majorVersion: 5
- provider: slack
majorVersion: 0
- provider: github
majorVersion: 5
- provider: random
majorVersion: 4
- provider: gcp
majorVersion: 6
- provider: google-native
majorVersion: 0
- provider: aws
majorVersion: 5
- provider: aws-native
majorVersion: 0
- provider: azure
majorVersion: 5
- provider: azure-native
majorVersion: 1
- provider: azure-native
majorVersion: 2
- provider: kubernetes
majorVersion: 3
- provider: kubernetes
majorVersion: 4
- provider: nomad
majorVersion: 0
- provider: docker
majorVersion: 3
- provider: docker
majorVersion: 4
- provider: gitlab
majorVersion: 4
- provider: gitlab
majorVersion: 5
- provider: gitlab
majorVersion: 6
- provider: digitalocean
majorVersion: 4
- provider: alicloud
majorVersion: 3
steps:
- id: provider
uses: ASzc/change-string-case-action@v5
Expand All @@ -60,10 +100,9 @@ jobs:
with open("src/main/resources/version-config.json") as version_config:
schemas = json.load(version_config)
versions = [
schema["kotlinVersion"]
for schema
in schemas
if schema["providerName"] + schema["kotlinVersion"].split(".")[0] == "${{ matrix.provider }}"
schema["kotlinVersion"] for schema in schemas
if schema["providerName"] == "${{ matrix.provider }}"
and schema["kotlinVersion"].split(".")[0] == "${{ matrix.majorVersion }}"
]
version = versions[0]
is_release = not version.endswith("-SNAPSHOT")
Expand All @@ -78,7 +117,7 @@ jobs:
- name: Publish packages
if: ${{ steps.check-for-release.outputs.is_release == 'true' }}
run: |
./gradlew publishPulumi${{ matrix.provider }}PublicationToMavenCentralRepository \
./gradlew publishPulumi${{ matrix.provider }}${{ matrix.majorVersion }}PublicationToMavenCentralRepository \
-Psigning.enabled=true \
-Psigning.key="${{ secrets.GPG_KEY }}" \
-Psigning.key.password="${{ secrets.GPG_KEY_PASSWORD }}" \
Expand All @@ -89,10 +128,10 @@ jobs:
- name: Rename Dokka directory before upload
if: ${{ steps.check-for-release.outputs.is_release == 'true' }}
run: |
file_name=$(ls ./build/libs/pulumi-${{ matrix.provider }}-*-javadoc.jar | xargs -n 1 basename)
file_name=$(ls ./build/libs/pulumi-${{ matrix.provider }}-kotlin-${{ matrix.majorVersion }}*-javadoc.jar | xargs -n 1 basename)
version=$(echo $file_name | sed -e "s/^pulumi-${{ matrix.provider }}-kotlin-//" -e "s/-javadoc.jar$//")
mkdir -p ./docs/${{ matrix.provider }}/$version
mv ./build/dokka/pulumi${{ steps.provider.outputs.capitalized }}Javadoc/* ./docs/${{ matrix.provider }}/$version
mv ./build/dokka/pulumi${{ steps.provider.outputs.capitalized }}${{ matrix.majorVersion }}Javadoc/* ./docs/${{ matrix.provider }}/$version
- name: Install Rclone
if: ${{ steps.check-for-release.outputs.is_release == 'true' }}
run: |
Expand Down
57 changes: 49 additions & 8 deletions .github/workflows/publish_to_maven_local.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,57 @@ on:

jobs:
publish:
name: Publish pulumi-kotlin to Maven Local Repository
name: Publish pulumi-${{ matrix.provider }}-kotlin (${{ matrix.majorVersion }}) to Maven Local Repository
runs-on: [ self-hosted, active ]
if: ${{ startsWith(github.head_ref, 'prepare-release') || github.event_name == 'push' || github.event_name == 'workflow_dispatch' }}
strategy:
fail-fast: false
matrix:
provider: [
cloudflare4, cloudflare5, slack0, github5, random4, gcp6, google-native0, aws5, aws-native0, azure5,
azure-native1, azure-native2, kubernetes3, kubernetes4, nomad0, docker3, docker4, gitlab4, gitlab5,
gitlab6, digitalocean4, alicloud3
]
include:
- provider: cloudflare
majorVersion: 4
- provider: cloudflare
majorVersion: 5
- provider: slack
majorVersion: 0
- provider: github
majorVersion: 5
- provider: random
majorVersion: 4
- provider: gcp
majorVersion: 6
- provider: google-native
majorVersion: 0
- provider: aws
majorVersion: 5
- provider: aws-native
majorVersion: 0
- provider: azure
majorVersion: 5
- provider: azure-native
majorVersion: 1
- provider: azure-native
majorVersion: 2
- provider: kubernetes
majorVersion: 3
- provider: kubernetes
majorVersion: 4
- provider: nomad
majorVersion: 0
- provider: docker
majorVersion: 3
- provider: docker
majorVersion: 4
- provider: gitlab
majorVersion: 4
- provider: gitlab
majorVersion: 5
- provider: gitlab
majorVersion: 6
- provider: digitalocean
majorVersion: 4
- provider: alicloud
majorVersion: 3
steps:
- name: Check out project sources
uses: actions/checkout@v3
Expand All @@ -47,14 +87,15 @@ jobs:
schemas = json.load(version_config)
versions = [
schema["kotlinVersion"] for schema in schemas
if schema["providerName"] + schema["kotlinVersion"].split(".")[0] == "${{ matrix.provider }}"
if schema["providerName"] == "${{ matrix.provider }}"
and schema["kotlinVersion"].split(".")[0] == "${{ matrix.majorVersion }}"
]
version = versions[0]
is_release = not version.endswith("-SNAPSHOT")
with open(os.environ['GITHUB_OUTPUT'], 'a') as fh:
fh.write('is_release=' + str(is_release).lower())
- name: Publish to Maven Local
run: ./gradlew publishPulumi${{ matrix.provider }}PublicationToMavenLocal -Dorg.gradle.daemon=false -q
run: ./gradlew publishPulumi${{ matrix.provider }}${{ matrix.majorVersion }}PublicationToMavenLocal -Dorg.gradle.daemon=false -q
if: |
(startsWith(github.head_ref, 'prepare-release') && steps.check-for-release.outputs.is_release == 'true') ||
(github.event_name == 'push' && steps.check-for-release.outputs.is_release == 'false') ||
Expand Down
24 changes: 15 additions & 9 deletions buildSrc/src/main/kotlin/code-generation.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,7 @@ val createTasksForProvider by extra {
val javadocPublicationName = "${sourceSetName}Javadoc"
val downloadTaskName = "download${schema.versionedProviderName.capitalized()}Schema"

val schemaDownloadPath = Paths.get(
rootDir, "build", "tmp", "schema", "${schema.versionedProviderName}-$version.json",
)
val schemaDownloadPath = Paths.get(rootDir, "build", "tmp", "schema", "${schema.providerName}-$version.json")
.toFile()

createDownloadTask(downloadTaskName, schemaUrl, schemaDownloadPath)
Expand Down Expand Up @@ -97,20 +95,28 @@ val createE2eTasksForProvider by extra {
val version = schema.kotlinVersion
val javaLibraryDependency = "com.pulumi:$providerName:${schema.javaVersion}"

val sourceSetName = "pulumi${providerName.capitalized()}E2e"
val sourceSetName = "pulumi${schema.versionedProviderName.capitalized()}E2e"
val generationTaskName = "generate${sourceSetName.capitalized()}Sources"
val compilationTaskName = "compile${sourceSetName.capitalized()}Kotlin"
val jarTaskName = "${sourceSetName}Jar"
val implementationDependency = "${sourceSetName}Implementation"
val archiveName = "pulumi-$providerName-kotlin"
val downloadTaskName = "download${providerName.capitalized()}E2eSchema"
val downloadTaskName = "download${schema.versionedProviderName.capitalized()}E2eSchema"

val schemaDownloadPath =
Paths.get(rootDir, "build", "tmp", "schema", "e2e", "$providerName-$version.json").toFile()
val schemaDownloadPath = Paths.get(
rootDir, "build", "tmp", "schema", "e2e", "${schema.providerName}-$version.json",
)
.toFile()

createDownloadTask(downloadTaskName, schemaUrl, schemaDownloadPath)
createGenerationTask(generationTaskName, downloadTaskName, schemaDownloadPath, outputDirectory, providerName)
createSourceSet(sourceSetName, outputDirectory, providerName)
createGenerationTask(
generationTaskName,
downloadTaskName,
schemaDownloadPath,
File(outputDirectory, "e2e"),
schema.versionedProviderName,
)
createSourceSet(sourceSetName, File(outputDirectory, "e2e"), schema.versionedProviderName)

tasks[generationTaskName].finalizedBy(tasks[compilationTaskName])

Expand Down

0 comments on commit bf102ab

Please sign in to comment.