Merge pull request #9 from andrewjswan/dependabot/github_actions/acti… #37
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: Build / MQTT Plugin | |
| on: | |
| push: | |
| # On Push to Master branch | |
| branches: | |
| - master | |
| # Ignore all Tags / Release | |
| tags-ignore: | |
| - '**' | |
| workflow_call: | |
| inputs: | |
| retention-build: | |
| description: "Retention Period for Setup files. Default is 90" | |
| default: 90 | |
| required: false | |
| type: number | |
| outputs: | |
| version: | |
| description: "MPE1 Version" | |
| value: ${{ jobs.mpe.outputs.version }} | |
| jobs: | |
| build: | |
| name: MQTT Plugin / Build | |
| runs-on: windows-2022 | |
| steps: | |
| - name: Git Checkout | |
| uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 | |
| - name: Nuget | |
| run: | | |
| nuget restore | |
| shell: cmd | |
| - name: Build | |
| run: | | |
| build_git.bat < nul | |
| working-directory: ${{ github.workspace }}\scripts | |
| shell: cmd | |
| - name: Upload Artifact / Plugin | |
| uses: actions/upload-artifact@v5 | |
| if: ${{ success() }} | |
| with: | |
| name: MQTTPlugin | |
| path: | | |
| ${{ github.workspace }}\MQTTPlugin\bin\Release\MQTTPlugin.dll | |
| ${{ github.workspace }}\MQTTPlugin\bin\Release\M2Mqtt.dll | |
| retention-days: ${{ inputs.retention-build || 90 }} | |
| if-no-files-found: error | |
| - name: Save cache | |
| uses: actions/cache/save@v4 | |
| with: | |
| path: ${{ github.workspace }} | |
| key: plugin | |
| changes: | |
| name: XMP2 / Changed | |
| runs-on: ubuntu-latest | |
| outputs: | |
| changes: ${{ steps.changes.outputs.xmp }} | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: dorny/paths-filter@v3 | |
| id: changes | |
| with: | |
| filters: | | |
| xmp: | |
| - '**.xmp2' | |
| codeql: | |
| name: CodeQL | |
| if: ${{ needs.changes.outputs.changes == 'true' }} | |
| uses: Mediaportal-Plugin-Team/Mediaportal-Tools/.github/workflows/codeql.yml@master | |
| needs: | |
| - build | |
| - changes | |
| permissions: | |
| security-events: write | |
| secrets: inherit | |
| mpe: | |
| name: MQTT Plugin / MPE | |
| runs-on: windows-2022 | |
| needs: | |
| - build | |
| - changes | |
| outputs: | |
| version: ${{ steps.version.outputs.version }} | |
| changes: ${{ needs.changes.outputs.changes }} | |
| steps: | |
| - name: Restore cache | |
| uses: actions/cache/restore@v4 | |
| with: | |
| path: ${{ github.workspace }} | |
| key: plugin | |
| - name: Git Checkout / MPE / XPath | |
| uses: actions/checkout@v6 | |
| with: | |
| repository: Mediaportal-Plugin-Team/Mediaportal-Tools | |
| path: MPE | |
| - name: MP folder for MPEMaker | |
| run: | | |
| mkdir "C:\Team MediaPortal" | |
| shell: cmd | |
| - name: Link to MPEMaker | |
| run: | | |
| mklink /J "C:\Team MediaPortal\MediaPortal" "${{ github.workspace }}\MPE\MPEMaker" | |
| shell: cmd | |
| - name: Clear Build folder | |
| run: | | |
| del /F /Q *.* | |
| working-directory: ${{ github.workspace }}\builds | |
| shell: cmd | |
| - name: Get MPE1 Version | |
| id: version | |
| run: | | |
| FOR /F "tokens=*" %%i IN ('Tools\sigcheck.exe -accepteula -nobanner -n "..\MQTTPlugin\bin\Release\MQTTPlugin.dll"') DO (ECHO version=%%i >> %GITHUB_OUTPUT%) | |
| working-directory: ${{ github.workspace }}\scripts | |
| shell: cmd | |
| - name: Build MPE1 | |
| run: | | |
| Create_Installer.bat | |
| working-directory: ${{ github.workspace }}\scripts | |
| shell: cmd | |
| - name: Upload Artifact / MPE1 | |
| uses: actions/upload-artifact@v5 | |
| if: ${{ success() }} | |
| with: | |
| name: MQTTPlugin MPE1 | |
| path: | | |
| ${{ github.workspace }}\builds\MQTTPlugin-*.mpe1 | |
| retention-days: ${{ inputs.retention-build || 90 }} | |
| if-no-files-found: error | |
| - name: Upload Artifact / MPE XML | |
| uses: actions/upload-artifact@v5 | |
| if: ${{ success() && needs.changes.outputs.changes == 'true' }} | |
| with: | |
| name: MQTTPlugin XML | |
| path: | | |
| ${{ github.workspace }}\scripts\MQTTPlugin.xml | |
| retention-days: ${{ inputs.retention-build || 90 }} | |
| if-no-files-found: error | |
| - name: Get Release Version Description | |
| if: ${{ success() && needs.changes.outputs.changes == 'true' }} | |
| run: | | |
| call ..\MPE\XPath\xpath.cmd "MQTTPlugin.xml" "//Items/PackageClass/GeneralInfo/VersionDescription" last > description.txt | |
| working-directory: ${{ github.workspace }}\scripts | |
| shell: cmd | |
| - name: Clean Release Version Description | |
| if: ${{ success() && needs.changes.outputs.changes == 'true' }} | |
| run: | | |
| sed.exe -i "s/\*\*\* We Stand with Ukraine \*\*\*//g" description.txt | |
| working-directory: ${{ github.workspace }}\scripts | |
| shell: cmd | |
| - name: Add Badges to Release Version Description | |
| if: ${{ success() && needs.changes.outputs.changes == 'true' }} | |
| run: | | |
| ECHO [](https://github.com/andrewjswan/MQTTPlugin/releases/tag/v${{steps.version.outputs.version}}) [](https://github.com/vshymanskyy/StandWithUkraine/blob/main/docs/README.md) >> description.txt | |
| working-directory: ${{ github.workspace }}\scripts | |
| shell: cmd | |
| - name: Clean Release Version Description | |
| if: ${{ success() && needs.changes.outputs.changes == 'true' }} | |
| run: | | |
| sed.exe -i "s/ \//\//g" description.txt | |
| working-directory: ${{ github.workspace }}\scripts | |
| shell: cmd | |
| - name: Upload Artifact / Version Description | |
| uses: actions/upload-artifact@v5 | |
| if: ${{ success() && needs.changes.outputs.changes == 'true' }} | |
| with: | |
| name: MQTTPlugin Version Description | |
| path: | | |
| ${{ github.workspace }}\scripts\description.txt | |
| retention-days: ${{ inputs.retention-build || 90 }} | |
| if-no-files-found: error | |
| xml: | |
| name: MQTT Plugin / XML | |
| runs-on: ubuntu-latest | |
| if: ${{ needs.mpe.outputs.changes == 'true' }} | |
| needs: | |
| - mpe | |
| permissions: | |
| contents: write | |
| outputs: | |
| changes: ${{ needs.mpe.outputs.changes }} | |
| steps: | |
| - name: Git Checkout | |
| uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 | |
| - name: Download Artifacts | |
| uses: actions/download-artifact@v7 | |
| with: | |
| name: MQTTPlugin XML | |
| path: ${{ github.workspace }}/scripts/ | |
| - name: Update / MPE1 XML | |
| uses: EndBug/add-and-commit@v9 | |
| with: | |
| message: 'MQTT Plugin ${{needs.mpe.outputs.version}} / Release' | |
| add: '${{ github.workspace }}/scripts/MQTTPlugin.xml' | |
| - name: Delete XML Artifact | |
| uses: geekyeggo/delete-artifact@v5 | |
| with: | |
| name: MQTTPlugin XML | |
| failOnError: false | |
| release: | |
| name: MQTT Plugin / Release | |
| if: ${{ needs.mpe.outputs.changes == 'true' }} | |
| needs: | |
| - mpe | |
| - xml | |
| permissions: | |
| contents: write | |
| outputs: | |
| changes: ${{ needs.mpe.outputs.changes }} | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Download Artifacts | |
| uses: actions/download-artifact@v7 | |
| with: | |
| name: MQTTPlugin MPE1 | |
| path: release-files | |
| - name: Download Artifacts | |
| uses: actions/download-artifact@v7 | |
| with: | |
| name: MQTTPlugin Version Description | |
| path: release-description | |
| - name: Check Artifacts | |
| run: | | |
| ls -l | |
| working-directory: release-files | |
| - name: Release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| name: MQTT Plugin v${{needs.mpe.outputs.version}} | |
| tag_name: v${{needs.mpe.outputs.version}} | |
| body_path: release-description/description.txt | |
| generate_release_notes: true | |
| files: | | |
| release-files/*.mpe1 | |
| - name: Delete MPE1 Artifact | |
| uses: geekyeggo/delete-artifact@v5 | |
| with: | |
| name: MQTTPlugin MPE1 | |
| failOnError: false | |
| - name: Delete Version Description Artifact | |
| uses: geekyeggo/delete-artifact@v5 | |
| with: | |
| name: MQTTPlugin Version Description | |
| failOnError: false | |
| ci-status: | |
| name: Build Status | |
| runs-on: ubuntu-latest | |
| needs: | |
| - build | |
| - mpe | |
| if: always() | |
| steps: | |
| - name: Success | |
| if: ${{ !(contains(needs.*.result, 'failure')) }} | |
| run: exit 0 | |
| - name: Failure | |
| if: ${{ contains(needs.*.result, 'failure') }} | |
| run: exit 1 | |
| release-status: | |
| name: Release Status | |
| if: ${{ needs.mpe.outputs.changes == 'true' }} | |
| runs-on: ubuntu-latest | |
| needs: | |
| - release | |
| steps: | |
| - name: Success | |
| if: ${{ !(contains(needs.*.result, 'failure')) }} | |
| run: exit 0 | |
| - name: Failure | |
| if: ${{ contains(needs.*.result, 'failure') }} | |
| run: exit 1 | |
| cache-clear: | |
| name: Clear cache | |
| runs-on: ubuntu-latest | |
| needs: | |
| - mpe | |
| if: always() | |
| steps: | |
| - name: Clear cache | |
| uses: easimon/wipe-cache@main |