Skip to content

Commit

Permalink
Rework Build Action
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewjswan committed Mar 23, 2024
1 parent ac7ce12 commit 6a4bfe6
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 34 deletions.
41 changes: 31 additions & 10 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,14 +62,29 @@ jobs:
path: ${{ github.workspace }}
key: plugin

changes:
name: XMP2 / Changed
runs-on: ubuntu-latest
outputs:
changes: ${{ steps.changes.outputs.xmp }}
steps:
- uses: actions/checkout@v4
- uses: dorny/paths-filter@v3
id: changes
with:
filters: |
xmp:
- '**.xmp2'
codeql:
name: CodeQL
if: "contains(github.event.head_commit.message, '[release]')"
if: ${{ needs.changes.outputs.changes == 'true' }}
uses: andrewjswan/MPE/.github/workflows/codeql.yml@master
with:
build-path: CecRemote\Installer
needs:
- build
- changes
permissions:
security-events: write
secrets: inherit
Expand All @@ -79,8 +94,10 @@ jobs:
runs-on: windows-2019
needs:
- build
- changes
outputs:
version: ${{ steps.version.outputs.version }}
changes: ${{ needs.changes.outputs.changes }}
steps:
- name: Restore cache
uses: actions/cache/restore@v4
Expand Down Expand Up @@ -135,7 +152,7 @@ jobs:

- name: Upload Artifact / MPE XML
uses: actions/upload-artifact@v4
if: ${{ success() && contains(github.event.head_commit.message, '[release]') }}
if: ${{ success() && needs.changes.outputs.changes == 'true' }}
with:
name: CECRemote XML
path: |
Expand All @@ -144,36 +161,36 @@ jobs:
if-no-files-found: error

- name: Get Release Version Description
if: ${{ success() && contains(github.event.head_commit.message, '[release]') }}
if: ${{ success() && needs.changes.outputs.changes == 'true' }}
run: |
call ..\..\MPE\XPath\xpath.cmd "CECRemote.xml" "//Items/PackageClass/GeneralInfo/VersionDescription" last > description.txt
working-directory: ${{ github.workspace }}\CecRemote\Release
shell: cmd

- name: Clean Release Version Description
if: ${{ success() && contains(github.event.head_commit.message, '[release]') }}
if: ${{ success() && needs.changes.outputs.changes == 'true' }}
run: |
sed.exe -i "s/\*\*\* We Stand with Ukraine \*\*\*//g" description.txt
working-directory: ${{ github.workspace }}\CecRemote\Release
shell: cmd

- name: Add Badges to Release Version Description
if: ${{ success() && contains(github.event.head_commit.message, '[release]') }}
if: ${{ success() && needs.changes.outputs.changes == 'true' }}
run: |
ECHO [![Downloads](https://img.shields.io/github/downloads/andrewjswan/CECRemote/v${{steps.version.outputs.version}}/total)](https://github.com/andrewjswan/CECRemote/releases/tag/v${{steps.version.outputs.version}}) [![StandWithUkraine](https://raw.githubusercontent.com/vshymanskyy/StandWithUkraine/main/badges/StandWithUkraine.svg)](https://github.com/vshymanskyy/StandWithUkraine/blob/main/docs/README.md) >> description.txt
working-directory: ${{ github.workspace }}\CecRemote\Release
shell: cmd

- name: Clean Release Version Description
if: ${{ success() && contains(github.event.head_commit.message, '[release]') }}
if: ${{ success() && needs.changes.outputs.changes == 'true' }}
run: |
sed.exe -i "s/ \//\//g" description.txt
working-directory: ${{ github.workspace }}\CecRemote\Release
shell: cmd

- name: Upload Artifact / Version Description
uses: actions/upload-artifact@v4
if: ${{ success() && contains(github.event.head_commit.message, '[release]') }}
if: ${{ success() && needs.changes.outputs.changes == 'true' }}
with:
name: CECRemote Version Description
path: |
Expand All @@ -184,11 +201,13 @@ jobs:
xml:
name: CEC Remote / XML
runs-on: ubuntu-latest
if: "contains(github.event.head_commit.message, '[release]')"
if: ${{ needs.mpe.outputs.changes == 'true' }}
needs:
- mpe
permissions:
contents: write
outputs:
changes: ${{ needs.mpe.outputs.changes }}
steps:
- name: Git Checkout
uses: actions/checkout@v4
Expand All @@ -215,12 +234,14 @@ jobs:

release:
name: CEC Remote / Release
if: "contains(github.event.head_commit.message, '[release]')"
if: ${{ needs.mpe.outputs.changes == 'true' }}
needs:
- mpe
- xml
permissions:
contents: write
outputs:
changes: ${{ needs.mpe.outputs.changes }}

runs-on: ubuntu-latest

Expand Down Expand Up @@ -281,7 +302,7 @@ jobs:

release-status:
name: Release Status
if: "contains(github.event.head_commit.message, '[release]')"
if: ${{ needs.release.outputs.changes == 'true' }}
runs-on: ubuntu-latest
needs:
- release
Expand Down
4 changes: 2 additions & 2 deletions CecRemote/Installer/CECRemote.xmp2
Original file line number Diff line number Diff line change
Expand Up @@ -223,10 +223,10 @@ Click Next to continue or Cancel to exit Setup.</Value>
AnyCPU version</VersionDescription>
<DevelopmentStatus>Stable</DevelopmentStatus>
<OnlineLocation>https://github.com/andrewjswan/CECRemote/releases/download/v[Version]/CECRemote-[Version].mpe1</OnlineLocation>
<ReleaseDate>2024-03-22T23:06:34</ReleaseDate>
<ReleaseDate>2024-03-23T21:26:57.098697+02:00</ReleaseDate>
<Tags>cec, remote</Tags>
<PlatformCompatibility>AnyCPU</PlatformCompatibility>
<Location>..\Release\CECRemote-MAJOR.MINOR.BUILD.REVISION.mpe1</Location>
<Location>..\Release\CECRemote-[Version].mpe1</Location>
<Params>
<Items>
<SectionParam Name="Icon">
Expand Down
23 changes: 1 addition & 22 deletions CecRemote/Installer/Create_Installer.bat
Original file line number Diff line number Diff line change
Expand Up @@ -17,26 +17,5 @@ IF NOT EXIST "%PROGS%\Team MediaPortal\MediaPortal\" SET PROGS=C:
:: Get version from DLL
FOR /F "tokens=*" %%i IN ('Tools\sigcheck.exe /accepteula /nobanner /n "..\Source\bin\Release\CECRemote.dll"') DO (SET version=%%i)

:: Temp xmp2 file
copy CECRemote%.xmp2 CECRemoteTemp.xmp2

:: Sed "{VERSION}" from xmp2 file
Tools\sed.exe -i "s/{VERSION}/%version%/g" CECRemoteTemp.xmp2

:: Build MPE1
"%PROGS%\Team MediaPortal\MediaPortal\MPEMaker.exe" CECRemoteTemp.xmp2 /B /V=%version% /UpdateXML

:: Cleanup
del CECRemoteTemp.xmp2

:: Parse version (Might be needed in the futute)
FOR /F "tokens=1-4 delims=." %%i IN ("%version%") DO (
SET major=%%i
SET minor=%%j
SET build=%%k
SET revision=%%l
)

:: Rename MPE1
if exist "..\Release\CECRemote-%major%.%minor%.%build%.%revision%.mpe1" del "..\Release\CECRemote-%major%.%minor%.%build%.%revision%.mpe1"
rename ..\Release\CECRemote-MAJOR.MINOR.BUILD.REVISION.mpe1 "CECRemote-%major%.%minor%.%build%.%revision%.mpe1"
"%PROGS%\Team MediaPortal\MediaPortal\MPEMaker.exe" CECRemote.xmp2 /B /V=%version% /UpdateXML

0 comments on commit 6a4bfe6

Please sign in to comment.