Trigger Database Update in Core Repo #1
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: Trigger Database Update in Core Repo | |
on: | |
workflow_dispatch: | |
inputs: | |
sdk_tag: | |
type: string | |
description: Provide the SDK release tag | |
default: "mikroSDK-2.13.1" | |
database_version: | |
type: choice | |
description: Database version to update | |
options: | |
- Test | |
- Live | |
jobs: | |
upload_board_assets_dev: | |
runs-on: ubuntu-latest | |
permissions: | |
actions: read | |
steps: | |
- name: Authorize Mikroe Actions App | |
uses: actions/create-github-app-token@v1 | |
id: app-token | |
with: | |
app-id: ${{ vars.MIKROE_ACTIONS }} | |
private-key: ${{ secrets.MIKROE_ACTIONS_KEY_AUTHORIZE }} | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.event.inputs.release_branch }} # Dynamically using the branch input | |
token: ${{ steps.app-token.outputs.token }} | |
- name: Add GitHub Actions credentials | |
run: | | |
git config user.name github-actions | |
git config user.email [email protected] | |
- name: Trigger Database update in Core repo | |
run: | | |
# Set the required variables | |
repo_owner="MikroElektronika" | |
repo_name="core_packages" | |
event_type="trigger-workflow" | |
version="${{ github.event.inputs.sdk_tag }}" | |
curl -L \ | |
-X POST \ | |
-H "Accept: application/vnd.github+json" \ | |
-H "Authorization: Bearer ${{ secrets.MIKROE_ACTIONS_KEY }}" \ | |
-H "X-GitHub-Api-Version: 2022-11-28" \ | |
https://api.github.com/repos/$repo_owner/$repo_name/dispatches \ | |
-d "{\"event_type\": \"$event_type\", \"client_payload\": {\"version\": \"$version\", \"index\": \"${{ github.event.inputs.database_version }}\", \"unit\": false, \"integration\": true}}" |