Skip to content

Publish all packages #187

Publish all packages

Publish all packages #187

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"]'
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 }}
package-version: ${{ inputs.package-version || '0.0.2' }}
csharp: ${{ contains(fromJSON(inputs.packages-to-publish), 'csharp') }}
csharp-ref: ${{ inputs.csharp-ref || inputs.ref || github.sha }}
golang: ${{ contains(fromJSON(inputs.packages-to-publish), 'golang') }}
maven: ${{ contains(fromJSON(inputs.packages-to-publish), 'maven') }}
kotlin-mpp: ${{ contains(fromJSON(inputs.packages-to-publish), 'kotlin-mpp') }}
flutter: ${{ contains(fromJSON(inputs.packages-to-publish), 'flutter') }}
react-native: ${{ contains(fromJSON(inputs.packages-to-publish), 'react-native') }}
python: ${{ contains(fromJSON(inputs.packages-to-publish), 'python') }}
swift: ${{ contains(fromJSON(inputs.packages-to-publish), 'swift') }}
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 }}
build-windows-binaries: ${{ needs.pre-setup.outputs.csharp == 'true' || needs.pre-setup.outputs.golang == 'true' || needs.pre-setup.outputs.python == 'true' }}
build-darwin-binaries: ${{ needs.pre-setup.outputs.csharp == 'true' || needs.pre-setup.outputs.golang == 'true' || needs.pre-setup.outputs.python == 'true' || needs.pre-setup.outputs.swift == 'true' }}
build-linux-binaries: ${{ needs.pre-setup.outputs.csharp == 'true' || needs.pre-setup.outputs.golang == 'true' || needs.pre-setup.outputs.python == 'true' }}
build-android-binaries: ${{ needs.pre-setup.outputs.kotlin-mpp == 'true' || needs.pre-setup.outputs.maven == 'true' || needs.pre-setup.outputs.golang == 'true' }}
build-ios-binaries: ${{ needs.pre-setup.outputs.kotlin-mpp == 'true' || needs.pre-setup.outputs.maven == 'true' || needs.pre-setup.outputs.swift == 'true' }}
build-kotlin-language-bindings: ${{ needs.pre-setup.outputs.kotlin-mpp == 'true' || needs.pre-setup.outputs.maven == 'true' || needs.pre-setup.outputs.flutter == 'true' }}
build-swift-language-bindings: ${{ needs.pre-setup.outputs.flutter == 'true' || needs.pre-setup.outputs.swift == 'true' }}
build-python-language-bindings: ${{ needs.pre-setup.outputs.python == 'true' }}
build-csharp-language-bindings: ${{ needs.pre-setup.outputs.csharp == 'true' }}
build-golang-language-bindings: ${{ needs.pre-setup.outputs.golang == 'true' }}
build-csharp-package: ${{ needs.pre-setup.outputs.csharp == 'true' }}
publish-csharp-package: ${{ needs.pre-setup.outputs.csharp == 'true' && needs.pre-setup.publish == 'true' }}
build-golang-package: ${{ needs.pre-setup.outputs.golang == 'true' }}
publish-golang-package: ${{ needs.pre-setup.outputs.golang == 'true' && needs.pre-setup.publish == 'true' }}
build-maven-package: ${{ needs.pre-setup.outputs.maven == 'true' }}
publish-maven-package: ${{ needs.pre-setup.outputs.maven == 'true' && needs.pre-setup.publish == 'true' }}
build-kotlin-mpp-package: ${{ needs.pre-setup.outputs.kotlin-mpp == 'true' }}
publish-kotlin-mpp-package: ${{ needs.pre-setup.outputs.kotlin-mpp == 'true' && needs.pre-setup.publish == 'true' }}
build-flutter-package: ${{ needs.pre-setup.outputs.flutter == 'true' }}
publish-flutter-package: ${{ needs.pre-setup.outputs.flutter == 'true' && needs.pre-setup.publish == 'true' }}
build-react-native-package: ${{ needs.pre-setup.outputs.react-native == 'true' }}
publish-react-native-package: ${{ needs.pre-setup.outputs.react-native == 'true' && needs.pre-setup.publish == 'true' }}
build-python-package: ${{ needs.pre-setup.outputs.python == 'true' }}
publish-python-package: ${{ needs.pre-setup.outputs.python == 'true' && needs.pre-setup.publish == 'true' }}
build-swift-package: ${{ needs.pre-setup.outputs.swift == 'true' }}
publish-swift-package: ${{ needs.pre-setup.outputs.swift == 'true' && needs.pre-setup.publish == 'true' }}
ref: ${{ needs.pre-setup.outputs.ref }}
csharp-ref: ${{ needs.pre-setup.outputs.csharp-ref }}
use-dummy-binaries: ${{ needs.pre-setup.outputs.use-dummy-binaries }}
package-version: ${{ needs.pre-setup.outputs.package-version }}
steps:
- run: echo "set setup output variables"
build-windows-binaries:
needs: setup
if: ${{ needs.setup.outputs.build-windows-binaries == '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-darwin-binaries:
needs: setup
if: ${{ needs.setup.outputs.build-darwin-binaries == '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-linux-binaries:
needs: setup
if: ${{ needs.setup.outputs.build-linux-binaries == '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-android-binaries:
needs: setup
if: ${{ needs.setup.outputs.build-android-binaries == '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-ios-binaries:
needs: setup
if: ${{ needs.setup.outputs.build-ios-binaries == '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.build-kotlin-language-bindings == 'true'}}
csharp: ${{ needs.setup.outputs.build-csharp-language-bindings == 'true'}}
golang: ${{ needs.setup.outputs.build-golang-language-bindings == 'true'}}
python: ${{ needs.setup.outputs.build-python-language-bindings == 'true'}}
swift: ${{ needs.setup.outputs.build-swift-language-bindings == 'true'}}
build-csharp-package:
needs:
- setup
- build-windows-binaries
- build-darwin-binaries
- build-linux-binaries
- build-language-bindings
if: ${{ needs.setup.outputs.build-csharp-package == 'true' }}
uses: ./.github/workflows/publish-csharp.yml
with:
repository: ${{ needs.setup.outputs.repository }}
ref: ${{ needs.setup.outputs.csharp-ref }}
package-version: ${{ needs.setup.outputs.package-version }}
publish: ${{ needs.setup.outputs.publish-csharp-package == 'true' }}
skip-tests: ${{ needs.setup.outputs.use-dummy-binaries == 'true' }}
secrets:
NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }}
build-golang-package:
needs:
- setup
- build-android-binaries
- build-windows-binaries
- build-darwin-binaries
- build-linux-binaries
- build-language-bindings
if: ${{ needs.setup.outputs.build-golang-package == 'true' }}
uses: ./.github/workflows/publish-golang.yml
with:
ref: ${{ needs.setup.outputs.ref }}
package-version: ${{ needs.setup.outputs.package-version }}
publish: ${{ needs.setup.outputs.publish-golang-package == 'true' }}
secrets:
REPO_SSH_KEY: ${{ secrets.REPO_SSH_KEY }}
build-maven-package:
needs:
- setup
- build-android-binaries
- build-language-bindings
if: ${{ needs.setup.outputs.build-maven-package == 'true' }}
uses: ./.github/workflows/publish-android.yml
with:
repository: ${{ needs.setup.outputs.repository }}
ref: ${{ needs.setup.outputs.ref }}
package-version: ${{ needs.setup.outputs.package-version }}
publish: ${{ needs.setup.outputs.publish-maven-package == 'true' }}
secrets:
BREEZ_MVN_USERNAME: ${{ secrets.BREEZ_MVN_USERNAME }}
BREEZ_MVN_PASSWORD: ${{ secrets.BREEZ_MVN_PASSWORD }}
build-kotlin-mpp-package:
needs:
- setup
- build-android-binaries
- build-ios-binaries
- build-language-bindings
if: ${{ needs.setup.outputs.build-kotlin-mpp-package == 'true' }}
uses: ./.github/workflows/publish-kotlin-mpp.yml
with:
repository: ${{ needs.setup.outputs.repository }}
ref: ${{ needs.setup.outputs.ref }}
package-version: ${{ needs.setup.outputs.package-version }}
publish: ${{ needs.setup.outputs.publish-kotlin-mpp-package == 'true' }}
secrets:
BREEZ_MVN_USERNAME: ${{ secrets.BREEZ_MVN_USERNAME }}
BREEZ_MVN_PASSWORD: ${{ secrets.BREEZ_MVN_PASSWORD }}
build-flutter-package-no-publish-swift:
needs:
- setup
- build-language-bindings
if: ${{ needs.setup.outputs.publish-swift-package != 'true' && needs.setup.outputs.build-flutter-package == 'true' }}
uses: ./.github/workflows/publish-flutter.yml
with:
repository: ${{ needs.setup.outputs.repository }}
ref: ${{ needs.setup.outputs.ref }}
package-version: ${{ needs.setup.outputs.package-version }}
publish: ${{ needs.setup.outputs.publish-flutter-package == 'true' }}
secrets:
REPO_SSH_KEY: ${{ secrets.REPO_SSH_KEY }}
build-flutter-package-publish-swift:
needs:
- setup
- build-language-bindings
- build-swift-package
if: ${{ needs.setup.outputs.publish-swift-package == 'true' && needs.setup.outputs.build-flutter-package == 'true' }}
uses: ./.github/workflows/publish-flutter.yml
with:
repository: ${{ needs.setup.outputs.repository }}
ref: ${{ needs.setup.outputs.ref }}
package-version: ${{ needs.setup.outputs.package-version }}
publish: ${{ needs.setup.outputs.publish-flutter-package == 'true' }}
secrets:
REPO_SSH_KEY: ${{ secrets.REPO_SSH_KEY }}
# react native version x.y.z will at runtime require
# ios and android packages x.y.z being published already.
build-react-native-package-no-publish-swift:
needs:
- setup
if: ${{ needs.setup.outputs.publish-swift-package != 'true' && needs.setup.outputs.build-react-native-package == 'true' }}
uses: ./.github/workflows/publish-react-native.yml
with:
repository: ${{ needs.setup.outputs.repository }}
ref: ${{ needs.setup.outputs.ref }}
package-version: ${{ needs.setup.outputs.package-version }}
publish: ${{ needs.setup.outputs.publish-react-native-package == 'true' }}
secrets:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
# react native version x.y.z will at runtime require
# ios and android packages x.y.z being published already.
build-react-native-package-publish-swift:
needs:
- setup
- build-swift-package
if: ${{ needs.setup.outputs.publish-swift-package == 'true' && needs.setup.outputs.build-react-native-package == 'true' }}
uses: ./.github/workflows/publish-react-native.yml
with:
repository: ${{ needs.setup.outputs.repository }}
ref: ${{ needs.setup.outputs.ref }}
package-version: ${{ needs.setup.outputs.package-version }}
publish: ${{ needs.setup.outputs.publish-react-native-package == 'true' }}
secrets:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
build-python-package:
needs:
- setup
- build-darwin-binaries
- build-linux-binaries
- build-windows-binaries
- build-language-bindings
if: ${{ needs.setup.outputs.build-python-package == 'true' }}
uses: ./.github/workflows/publish-python.yml
with:
repository: ${{ needs.setup.outputs.repository }}
ref: ${{ needs.setup.outputs.ref }}
package-version: ${{ needs.setup.outputs.package-version }}
publish: ${{ needs.setup.outputs.publish-python-package == 'true' }}
secrets:
PYPI_API_TOKEN: ${{ secrets.PYPI_API_TOKEN }}
build-swift-package:
needs:
- setup
- build-darwin-binaries
- build-ios-binaries
- build-language-bindings
if: ${{ needs.setup.outputs.build-swift-package == 'true' }}
uses: ./.github/workflows/build-swift-package.yml
with:
repository: ${{ needs.setup.outputs.repository }}
ref: ${{ needs.setup.outputs.ref }}
package-version: ${{ needs.setup.outputs.package-version }}
publish: ${{ needs.setup.outputs.publish-swift-package == 'true' }}
secrets:
REPO_SSH_KEY: ${{ secrets.REPO_SSH_KEY }}
COCOAPODS_TRUNK_TOKEN: ${{ secrets.COCOAPODS_TRUNK_TOKEN }}