Skip to content

Commit

Permalink
fix: inherit secret and add debug for workflows (#299)
Browse files Browse the repository at this point in the history
* fix: inherit secret for reusable workflow

* fix: add optional debug input to publish workflows

* fix: Pass GPG key id to gradle
  • Loading branch information
diogomatsubara authored Nov 18, 2024
1 parent 2f9daf4 commit a1e9fef
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 5 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ jobs:
with:
snapshot: true
branch: ${{ github.ref_name }}
secrets: inherit

publish_android_snapshot_package:
name: Publish Android snapshot package
Expand All @@ -97,3 +98,4 @@ jobs:
with:
snapshot: true
branch: ${{ github.ref_name }}
secrets: inherit
14 changes: 12 additions & 2 deletions .github/workflows/publish-android.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ on:
description: Target branch
type: string
required: false
debug:
description: If true, pass --debug flag to gradle
type: boolean
required: false
workflow_dispatch:

env:
Expand Down Expand Up @@ -70,15 +74,21 @@ jobs:
echo "PUB_MODE=-PSNAPSHOT" >> $GITHUB_ENV
fi
- name: Set debug env var
run: |
if [[ "${{ inputs.debug }}" == "true" ]]; then
echo "DEBUG=--debug" >> $GITHUB_ENV
fi
- name: Gradle Publish Android Package to GitHub packages repository
run: ./gradlew publishAndroidReleasePublicationToGithubPackagesRepository -PremotePublication=true -Pandroid=true ${{ env.PUB_MODE }}
run: ./gradlew publishAndroidReleasePublicationToGithubPackagesRepository -PremotePublication=true -Pandroid=true ${{ env.PUB_MODE }} ${{ env.DEBUG }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
ORG_GPG_PRIVATE_KEY: ${{ secrets.ORG_GPG_PRIVATE_KEY }}
ORG_GPG_PASSPHRASE: ${{ secrets.ORG_GPG_PASSPHRASE }}

- name: Gradle Publish Android Package to Maven Central repository
run: ./gradlew publishAndroidReleasePublicationToMavenCentralRepository -PremotePublication=true -Pandroid=true ${{ env.PUB_MODE }}
run: ./gradlew publishAndroidReleasePublicationToMavenCentralRepository -PremotePublication=true -Pandroid=true ${{ env.PUB_MODE }} ${{ env.DEBUG }}
env:
ORG_OSSRH_USERNAME: ${{ secrets.ORG_OSSRH_USERNAME }}
ORG_OSSRH_PASSWORD: ${{ secrets.ORG_OSSRH_PASSWORD }}
Expand Down
17 changes: 15 additions & 2 deletions .github/workflows/publish-jvm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ on:
description: Target branch
type: string
required: false
debug:
description: "Pass --debug to gradle"
type: boolean
required: false
workflow_dispatch:

env:
Expand Down Expand Up @@ -175,17 +179,26 @@ jobs:
echo "PUB_MODE=-PSNAPSHOT" >> $GITHUB_ENV
fi
- name: Set debug env var
run: |
if [[ "${{ inputs.debug }}" == "true" ]]; then
echo "DEBUG=--debug" >> $GITHUB_ENV
fi
- name: Gradle Publish JVM Package to GitHub packages repository
run: ./gradlew publishJvmPublicationToGithubPackagesRepository -PremotePublication=true ${{ env.PUB_MODE }}
run: ./gradlew publishJvmPublicationToGithubPackagesRepository -PremotePublication=true ${{ env.PUB_MODE }} ${{ env.DEBUG }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
ORG_GPG_KEY_ID: ${{ secrets.ORG_GPG_KEY_ID }}
ORG_GPG_PRIVATE_KEY: ${{ secrets.ORG_GPG_PRIVATE_KEY }}
ORG_GPG_PASSPHRASE: ${{ secrets.ORG_GPG_PASSPHRASE }}


- name: Gradle Publish JVM Package to Maven Central repository
run: ./gradlew publishJvmPublicationToMavenCentralRepository -PremotePublication=true ${{ env.PUB_MODE }}
run: ./gradlew publishJvmPublicationToMavenCentralRepository -PremotePublication=true ${{ env.PUB_MODE }} ${{ env.DEBUG }}
env:
ORG_OSSRH_USERNAME: ${{ secrets.ORG_OSSRH_USERNAME }}
ORG_OSSRH_PASSWORD: ${{ secrets.ORG_OSSRH_PASSWORD }}
ORG_GPG_KEY_ID: ${{ secrets.ORG_GPG_KEY_ID }}
ORG_GPG_PRIVATE_KEY: ${{ secrets.ORG_GPG_PRIVATE_KEY }}
ORG_GPG_PASSPHRASE: ${{ secrets.ORG_GPG_PASSPHRASE }}
6 changes: 6 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ on:
type: string
description: Release branch
required: false
debug:
type: boolean
description: Pass --debug flag to gradle
required: false

jobs:
tag:
Expand Down Expand Up @@ -75,6 +79,7 @@ jobs:
with:
snapshot: ${{ !(inputs.live-run || false) }}
branch: ${{ needs.tag.outputs.branch }}
debug: ${{ inputs.debug || false }}
permissions:
contents: read
packages: write
Expand All @@ -87,6 +92,7 @@ jobs:
with:
snapshot: ${{ !(inputs.live-run || false) }}
branch: ${{ needs.tag.outputs.branch }}
debug: ${{ inputs.debug || false }}
permissions:
contents: read
packages: write
Expand Down
2 changes: 1 addition & 1 deletion zenoh-kotlin/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ kotlin {

signing {
isRequired = isRemotePublication
useInMemoryPgpKeys(System.getenv("ORG_GPG_PRIVATE_KEY"), System.getenv("ORG_GPG_PASSPHRASE"))
useInMemoryPgpKeys(System.getenv("ORG_GPG_KEY_ID"), System.getenv("ORG_GPG_PRIVATE_KEY"), System.getenv("ORG_GPG_PASSPHRASE"))
sign(publishing.publications)
}

Expand Down

0 comments on commit a1e9fef

Please sign in to comment.