mikroSDK v2.15.1 released #58
Workflow file for this run
This file contains hidden or 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: Release Asset Upload | |
on: | |
release: | |
types: [published] | |
workflow_dispatch: | |
inputs: | |
mcu_regex: | |
type: string | |
description: Provide regex for which MCUs SDK support is being released | |
default: "PIC18F97J94|PIC32MZ2048EFH144|STM32F429ZI" | |
necto_type: | |
type: choice | |
description: Release to Dev or Live NECTO? | |
options: | |
- Dev | |
- Live | |
jobs: | |
upload-release-asset: | |
if: ${{ github.event_name == 'release' }} | |
runs-on: ubuntu-latest | |
steps: | |
- name: Authorize Mikroe Actions App | |
uses: actions/create-github-app-token@v2 | |
id: app-token | |
with: | |
app-id: ${{ vars.MIKROE_ACTIONS }} | |
private-key: ${{ secrets.MIKROE_ACTIONS_KEY_AUTHORIZE }} | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
token: ${{ steps.app-token.outputs.token }} | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.x' | |
- name: Cache Python packages | |
uses: actions/cache@v4 | |
with: | |
path: ~/.cache/pip | |
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} | |
restore-keys: | | |
${{ runner.os }}-pip- | |
- name: Install Dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install requests | |
pip install chardet | |
pip install py7zr | |
- name: Run Keyword Replacement Script | |
## Replace keyword 'code' with '_code' (Microchip MCUs) | |
run: python -u scripts/keyword_replace.py "code" "_code" "thirdparty/ethernet/cyclonetcp" "cp1252" | |
- name: Run Package Script | |
run: python -u scripts/package.py ${{ steps.app-token.outputs.token }} ${{ github.repository }} ${{ github.event.release.tag_name }} "False" | |
- name: Compare Assets with Previous Release | |
run: python -u scripts/compare_assets.py ${{ steps.app-token.outputs.token }} ${{ github.repository }} "--current_tag" "${{ github.event.release.tag_name }}" "--previous_tag" "latest" | |
- name: Upload result_compare.txt as artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: result-compare | |
path: result_compare.txt | |
release-sdk-support: | |
if: ${{ github.event_name == 'workflow_dispatch' }} | |
runs-on: ubuntu-latest | |
steps: | |
- name: Authorize Mikroe Actions App | |
uses: actions/create-github-app-token@v2 | |
id: app-token | |
with: | |
app-id: ${{ vars.MIKROE_ACTIONS }} | |
private-key: ${{ secrets.MIKROE_ACTIONS_KEY_AUTHORIZE }} | |
- name: Trigger database update in Core repo | |
run: | | |
# Set the required variables | |
repo_owner="MikroElektronika" | |
repo_name="core_packages" | |
event_type="trigger-workflow-update-database-devices" | |
mcu_regex="${{ github.event.inputs.mcu_regex }}" | |
if [[ ${{ github.event.inputs.necto_type }} == "Live" ]]; then | |
index="Live" | |
else | |
index="Test" | |
fi | |
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\": {\"mcu_regex\": \"$mcu_regex\", \"index\": \"$index\", \"unit\": false, \"integration\": true}}" | |
- name: Send notification to Mattermost | |
env: | |
MATTERMOST_WEBHOOK_URL: ${{ secrets.MATTERMOST_WEBHOOK_URL_SDK }} | |
run: | | |
MCU_STRING="${{ github.event.inputs.mcu_regex }}" | |
NECTO_VERSION="${{ github.event.inputs.necto_type }} NECTO" | |
MESSAGE="SDK Support adding was triggered for the following MCUs in $NECTO_VERSION:\n$(echo "$MCU_STRING" | tr '|' '\n' | sed 's/^/- /')" | |
curl -X POST -H 'Content-Type: application/json' \ | |
--data "{\"text\": \"$MESSAGE\"}" \ | |
$MATTERMOST_WEBHOOK_URL |