Skip to content

Upgrade cross-platforms on release #86

Upgrade cross-platforms on release

Upgrade cross-platforms on release #86

name: Upgrade cross-platforms on release
on:
workflow_run:
workflows: [Publish SDKs]
types:
- completed
workflow_dispatch:
jobs:
prepare:
name: Wait for publishing and prepare sandwich version number
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion != 'failure' }}
outputs:
sandwich_version: ${{ steps.tag.outputs.sandwich_version }}
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- id: tag
name: Get Previous tag
run: echo sandwich_version=`git describe --tags \`git rev-list --tags --max-count=1\`` >> $GITHUB_OUTPUT
notify_cross_platforms:
permissions: write-all
name: Notify cross-platforms
runs-on: ubuntu-latest
needs: prepare
if: ${{ !endsWith(needs.prepare.outputs.sandwich_version, '.0') }}
steps:
- uses: actions/github-script@v6
with:
github-token: ${{ secrets.GH_TOKEN }}
script: |
await github.rest.actions.createWorkflowDispatch({
owner: 'qonversion',
repo: 'react-native-sdk',
workflow_id: 'upgrade_sandwich.yml',
ref: 'main',
inputs: {
sandwich_version: '${{ needs.prepare.outputs.sandwich_version }}'
},
})
await github.rest.actions.createWorkflowDispatch({
owner: 'qonversion',
repo: 'flutter-sdk',
workflow_id: 'upgrade_sandwich.yml',
ref: 'main',
inputs: {
sandwich_version: '${{ needs.prepare.outputs.sandwich_version }}'
},
})
await github.rest.actions.createWorkflowDispatch({
owner: 'qonversion',
repo: 'unity-sdk',
workflow_id: 'upgrade_sandwich.yml',
ref: 'main',
inputs: {
sandwich_version: '${{ needs.prepare.outputs.sandwich_version }}'
},
})
await github.rest.actions.createWorkflowDispatch({
owner: 'qonversion',
repo: 'cordova-plugin',
workflow_id: 'upgrade_sandwich.yml',
ref: 'main',
inputs: {
sandwich_version: '${{ needs.prepare.outputs.sandwich_version }}'
},
})
on_publishing_failed:
name: Cancel due to publishing failure
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion == 'failure' }}
steps:
- name: Fail job
run: |
echo "Publishing script failed"
exit 1