Publish all packages #264
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Publish all packages | |
on: | |
workflow_dispatch: | |
inputs: | |
ref: | |
description: 'commit/tag/branch reference' | |
required: true | |
type: string | |
package-version: | |
description: 'version for the published package(s) (MAJOR.MINOR.BUILD)' | |
required: true | |
type: string | |
packages-to-publish: | |
description: 'array of packages to publish (remove what you do not want)' | |
required: true | |
type: string | |
default: '["csharp", "golang", "maven", "kotlin-mpp", "flutter", "react-native", "python", "swift"]' | |
csharp-ref: | |
description: 'optional commit/tag/branch reference for the C# project. Defaults to ref.' | |
required: false | |
type: string | |
use-dummy-binaries: | |
description: 'boolean indicating whether to use dummies for the sdk binaries. Default = false.' | |
required: false | |
type: boolean | |
default: false | |
publish: | |
description: 'boolean indicating whether packages should be published. true to publish. false to build only. Default = false.' | |
required: false | |
type: boolean | |
default: false | |
workflow_call: | |
inputs: | |
repository: | |
description: 'sdk repository, defaults to current repository' | |
required: false | |
type: string | |
ref: | |
description: 'commit/tag/branch reference' | |
required: true | |
type: string | |
package-version: | |
description: 'version for the published package(s) (MAJOR.MINOR.BUILD)' | |
required: true | |
type: string | |
packages-to-publish: | |
description: 'array of packages to publish (remove what you do not want)' | |
required: true | |
type: string | |
default: '["csharp", "golang", "maven", "kotlin-mpp", "flutter", "react-native", "python", "swift"]' | |
csharp-ref: | |
description: 'optional commit/tag/branch reference for the C# project. Defaults to ref.' | |
required: false | |
type: string | |
use-dummy-binaries: | |
description: 'boolean indicating whether to use dummies for the sdk binaries. Default = false.' | |
required: false | |
type: boolean | |
default: false | |
jobs: | |
pre-setup: | |
name: Pre-setup | |
runs-on: ubuntu-latest | |
outputs: | |
# These outputs mimic the inputs for the workflow. | |
# Their only purpose is to be able to test this workflow if you make | |
# changes that you won't want to commit to main yet. | |
# You can set these values manually, to test how the CI behaves with | |
# certain inputs. | |
repository: ${{ inputs.repository || github.repository }} | |
ref: ${{ inputs.ref || github.sha }} | |
csharp-package-version: ${{ (contains(fromJSON(inputs.packages-to-publish), 'csharp') && inputs.package-version) || '' }} | |
csharp-ref: ${{ inputs.csharp-ref || inputs.ref || github.sha }} | |
golang-package-version: ${{ (contains(fromJSON(inputs.packages-to-publish), 'golang') && inputs.package-version) || '' }} | |
maven-package-version: ${{ (contains(fromJSON(inputs.packages-to-publish), 'maven') && inputs.package-version) || ''}} | |
kotlin-mpp-package-version: ${{ (contains(fromJSON(inputs.packages-to-publish), 'kotlin-mpp') && inputs.package-version) || '' }} | |
flutter-package-version: ${{ (contains(fromJSON(inputs.packages-to-publish), 'flutter') && inputs.package-version) || '' }} | |
react-native-package-version: ${{ (contains(fromJSON(inputs.packages-to-publish), 'react-native') && inputs.package-version) || '' }} | |
python-package-version: ${{ (contains(fromJSON(inputs.packages-to-publish), 'python') && inputs.package-version) || '' }} | |
swift-package-version: ${{ (contains(fromJSON(inputs.packages-to-publish), 'swift') && inputs.package-version) || '' }} | |
use-dummy-binaries: ${{ inputs.use-dummy-binaries }} | |
publish: ${{ inputs.publish }} | |
steps: | |
- run: echo "set pre-setup output variables" | |
setup: | |
name: Setup | |
needs: pre-setup | |
runs-on: ubuntu-latest | |
outputs: | |
# Careful, a boolean input is not a boolean output. A boolean input is | |
# actually a boolean, but these outputs are strings. All the boolean | |
# checks in this file have the format `boolean == 'true'`. So feel free | |
# to set these variables here to `true` or `false` | |
# (e.g. bindings-windows: true) if you want to test something. | |
repository: ${{ needs.pre-setup.outputs.repository }} | |
bindings-windows: ${{ !!needs.pre-setup.outputs.csharp-package-version || !!needs.pre-setup.outputs.golang-package-version || !!needs.pre-setup.outputs.python-package-version }} | |
bindings-darwin: ${{ !!needs.pre-setup.outputs.csharp-package-version || !!needs.pre-setup.outputs.golang-package-version || !!needs.pre-setup.outputs.python-package-version || !!needs.pre-setup.outputs.swift-package-version }} | |
bindings-linux: ${{ !!needs.pre-setup.outputs.csharp-package-version || !!needs.pre-setup.outputs.golang-package-version || !!needs.pre-setup.outputs.python-package-version }} | |
bindings-android: ${{ !!needs.pre-setup.outputs.kotlin-mpp-package-version || !!needs.pre-setup.outputs.maven-package-version || !!needs.pre-setup.outputs.golang-package-version }} | |
bindings-ios: ${{ !!needs.pre-setup.outputs.kotlin-mpp-package-version || !!needs.pre-setup.outputs.maven-package-version || !!needs.pre-setup.outputs.swift-package-version }} | |
kotlin: ${{ !!needs.pre-setup.outputs.kotlin-mpp-package-version || !!needs.pre-setup.outputs.maven-package-version || !!needs.pre-setup.outputs.flutter-package-version }} | |
swift: ${{ !!needs.pre-setup.outputs.flutter-package-version || !!needs.pre-setup.outputs.swift-package-version }} | |
python: ${{ !!needs.pre-setup.outputs.python-package-version }} | |
csharp: ${{ !!needs.pre-setup.outputs.csharp-package-version }} | |
golang: ${{ !!needs.pre-setup.outputs.golang-package-version }} | |
maven: ${{ !!needs.pre-setup.outputs.maven-package-version }} | |
kotlin-mpp: ${{ !!needs.pre-setup.outputs.kotlin-mpp-package-version }} | |
flutter: ${{ !!needs.pre-setup.outputs.flutter-package-version }} | |
react-native: ${{ !!needs.pre-setup.outputs.react-native-package-version }} | |
spm-cocoapods: ${{ !!needs.pre-setup.outputs.swift-package-version }} | |
ref: ${{ needs.pre-setup.outputs.ref }} | |
csharp-package-version: ${{ needs.pre-setup.outputs.csharp-package-version || '0.0.2' }} | |
csharp-ref: ${{ needs.pre-setup.outputs.csharp-ref }} | |
golang-package-version: ${{ needs.pre-setup.outputs.golang-package-version || '0.0.2' }} | |
maven-package-version: ${{ needs.pre-setup.outputs.maven-package-version || '0.0.2' }} | |
kotlin-mpp-package-version: ${{ needs.pre-setup.outputs.kotlin-mpp-package-version || '0.0.2' }} | |
flutter-package-version: ${{ needs.pre-setup.outputs.flutter-package-version || '0.0.2' }} | |
react-native-package-version: ${{ needs.pre-setup.outputs.react-native-package-version || '0.0.2' }} | |
python-package-version: ${{ needs.pre-setup.outputs.python-package-version || '0.0.2' }} | |
swift-package-version: ${{ needs.pre-setup.outputs.swift-package-version || '0.0.2' }} | |
publish: ${{ needs.pre-setup.outputs.publish }} | |
use-dummy-binaries: ${{ needs.pre-setup.outputs.use-dummy-binaries }} | |
steps: | |
- run: echo "set setup output variables" | |
build-bindings-windows: | |
needs: setup | |
if: ${{ needs.setup.outputs.bindings-windows == 'true' }} | |
uses: ./.github/workflows/build-bindings-windows.yml | |
with: | |
repository: ${{ needs.setup.outputs.repository }} | |
ref: ${{ needs.setup.outputs.ref }} | |
use-dummy-binaries: ${{ needs.setup.outputs.use-dummy-binaries == 'true' }} | |
build-bindings-darwin: | |
needs: setup | |
if: ${{ needs.setup.outputs.bindings-darwin == 'true' }} | |
uses: ./.github/workflows/build-bindings-darwin.yml | |
with: | |
repository: ${{ needs.setup.outputs.repository }} | |
ref: ${{ needs.setup.outputs.ref }} | |
use-dummy-binaries: ${{ needs.setup.outputs.use-dummy-binaries == 'true' }} | |
build-bindings-linux: | |
needs: setup | |
if: ${{ needs.setup.outputs.bindings-linux == 'true' }} | |
uses: ./.github/workflows/build-bindings-linux.yml | |
with: | |
repository: ${{ needs.setup.outputs.repository }} | |
ref: ${{ needs.setup.outputs.ref }} | |
use-dummy-binaries: ${{ needs.setup.outputs.use-dummy-binaries == 'true' }} | |
build-bindings-android: | |
needs: setup | |
if: ${{ needs.setup.outputs.bindings-android == 'true' }} | |
uses: ./.github/workflows/build-bindings-android.yml | |
with: | |
repository: ${{ needs.setup.outputs.repository }} | |
ref: ${{ needs.setup.outputs.ref }} | |
use-dummy-binaries: ${{ needs.setup.outputs.use-dummy-binaries == 'true' }} | |
build-bindings-ios: | |
needs: setup | |
if: ${{ needs.setup.outputs.bindings-ios == 'true' }} | |
uses: ./.github/workflows/build-bindings-ios.yml | |
with: | |
repository: ${{ needs.setup.outputs.repository }} | |
ref: ${{ needs.setup.outputs.ref }} | |
use-dummy-binaries: ${{ needs.setup.outputs.use-dummy-binaries == 'true' }} | |
build-language-bindings: | |
needs: setup | |
uses: ./.github/workflows/build-language-bindings.yml | |
with: | |
repository: ${{ needs.setup.outputs.repository }} | |
ref: ${{ needs.setup.outputs.ref }} | |
kotlin: ${{ needs.setup.outputs.kotlin == 'true'}} | |
csharp: ${{ needs.setup.outputs.csharp == 'true'}} | |
golang: ${{ needs.setup.outputs.golang == 'true'}} | |
python: ${{ needs.setup.outputs.python == 'true'}} | |
swift: ${{ needs.setup.outputs.swift == 'true'}} | |
publish-csharp: | |
needs: | |
- setup | |
- build-bindings-windows | |
- build-bindings-darwin | |
- build-bindings-linux | |
- build-language-bindings | |
if: ${{ needs.setup.outputs.csharp == 'true' }} | |
uses: ./.github/workflows/publish-csharp.yml | |
with: | |
repository: ${{ needs.setup.outputs.repository }} | |
ref: ${{ needs.setup.outputs.csharp-ref }} | |
package-version: ${{ needs.setup.outputs.csharp-package-version }} | |
publish: ${{ needs.setup.outputs.publish == 'true' }} | |
skip-tests: true | |
secrets: | |
NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }} | |
publish-golang: | |
needs: | |
- setup | |
- build-bindings-android | |
- build-bindings-windows | |
- build-bindings-darwin | |
- build-bindings-linux | |
- build-language-bindings | |
if: ${{ needs.setup.outputs.golang == 'true' }} | |
uses: ./.github/workflows/publish-golang.yml | |
with: | |
ref: ${{ needs.setup.outputs.ref }} | |
package-version: ${{ needs.setup.outputs.golang-package-version }} | |
publish: ${{ needs.setup.outputs.publish == 'true' }} | |
secrets: | |
REPO_SSH_KEY: ${{ secrets.REPO_SSH_KEY }} | |
publish-maven: | |
needs: | |
- setup | |
- build-bindings-android | |
- build-language-bindings | |
if: ${{ needs.setup.outputs.maven == 'true' }} | |
uses: ./.github/workflows/publish-android.yml | |
with: | |
repository: ${{ needs.setup.outputs.repository }} | |
ref: ${{ needs.setup.outputs.ref }} | |
package-version: ${{ needs.setup.outputs.maven-package-version }} | |
publish: ${{ needs.setup.outputs.publish == 'true' }} | |
secrets: | |
BREEZ_MVN_USERNAME: ${{ secrets.BREEZ_MVN_USERNAME }} | |
BREEZ_MVN_PASSWORD: ${{ secrets.BREEZ_MVN_PASSWORD }} | |
publish-kotlin-mpp: | |
needs: | |
- setup | |
- build-bindings-android | |
- build-bindings-ios | |
- build-language-bindings | |
if: ${{ needs.setup.outputs.kotlin-mpp == 'true' }} | |
uses: ./.github/workflows/publish-kotlin-mpp.yml | |
with: | |
repository: ${{ needs.setup.outputs.repository }} | |
ref: ${{ needs.setup.outputs.ref }} | |
package-version: ${{ needs.setup.outputs.kotlin-mpp-package-version }} | |
publish: ${{ needs.setup.outputs.publish == 'true' }} | |
secrets: | |
BREEZ_MVN_USERNAME: ${{ secrets.BREEZ_MVN_USERNAME }} | |
BREEZ_MVN_PASSWORD: ${{ secrets.BREEZ_MVN_PASSWORD }} | |
publish-flutter: | |
needs: | |
- setup | |
- build-language-bindings | |
- publish-swift | |
- publish-maven | |
# The flutter package depends on the swift and android packages to be available at runtime. | |
# Therefore, if swift and/or android publishing is turned on, we will run this job only if swift and/or android is successfully published. | |
# If however swift and/or android is skipped, we will run this job nonetheless. | |
if: ${{ needs.setup.outputs.flutter == 'true' && always() && !failure() && !cancelled() }} | |
uses: ./.github/workflows/publish-flutter.yml | |
with: | |
repository: ${{ needs.setup.outputs.repository }} | |
ref: ${{ needs.setup.outputs.ref }} | |
package-version: ${{ needs.setup.outputs.flutter-package-version }} | |
publish: ${{ needs.setup.outputs.publish == 'true' }} | |
secrets: | |
REPO_SSH_KEY: ${{ secrets.REPO_SSH_KEY }} | |
publish-react-native: | |
needs: | |
- setup | |
- publish-swift | |
- publish-maven | |
# The react native package depends on the swift and android packages to be available at runtime. | |
# Therefore, if swift and/or android publishing is turned on, we will run this job only if swift and/or android is successfully published. | |
# If however swift and/or android is skipped, we will run this job nonetheless. | |
if: ${{ needs.setup.outputs.react-native == 'true' && always() && !failure() && !cancelled() }} | |
uses: ./.github/workflows/publish-react-native.yml | |
with: | |
repository: ${{ needs.setup.outputs.repository }} | |
ref: ${{ needs.setup.outputs.ref }} | |
package-version: ${{ needs.setup.outputs.react-native-package-version }} | |
publish: ${{ needs.setup.outputs.publish == 'true' }} | |
secrets: | |
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | |
publish-python: | |
needs: | |
- setup | |
- build-bindings-darwin | |
- build-bindings-linux | |
- build-bindings-windows | |
- build-language-bindings | |
if: ${{ needs.setup.outputs.python == 'true' }} | |
uses: ./.github/workflows/publish-python.yml | |
with: | |
repository: ${{ needs.setup.outputs.repository }} | |
ref: ${{ needs.setup.outputs.ref }} | |
package-version: ${{ needs.setup.outputs.python-package-version }} | |
publish: ${{ needs.setup.outputs.publish == 'true' }} | |
secrets: | |
PYPI_API_TOKEN: ${{ secrets.PYPI_API_TOKEN }} | |
publish-swift: | |
needs: | |
- setup | |
- build-bindings-darwin | |
- build-bindings-ios | |
- build-language-bindings | |
if: ${{ needs.setup.outputs.spm-cocoapods == 'true' }} | |
uses: ./.github/workflows/publish-swift.yml | |
with: | |
repository: ${{ needs.setup.outputs.repository }} | |
ref: ${{ needs.setup.outputs.ref }} | |
package-version: ${{ needs.setup.outputs.swift-package-version }} | |
publish: ${{ needs.setup.outputs.publish == 'true' }} | |
secrets: | |
REPO_SSH_KEY: ${{ secrets.REPO_SSH_KEY }} | |
SWIFT_RELEASE_TOKEN: ${{ secrets. SWIFT_RELEASE_TOKEN }} | |
COCOAPODS_TRUNK_TOKEN: ${{ secrets.COCOAPODS_TRUNK_TOKEN }} |