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 27, 2024
1 parent 8744b7f commit 28fc23e
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 34 deletions.
47 changes: 34 additions & 13 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,27 @@ 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
needs:
- build
- changes
permissions:
security-events: write
secrets: inherit
Expand All @@ -73,8 +88,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 @@ -129,7 +146,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: MyVideoImporter XML
path: |
Expand All @@ -138,36 +155,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 "MyVideoImporter.xml" "//Items/PackageClass/GeneralInfo/VersionDescription" last > description.txt
working-directory: ${{ github.workspace }}\scripts
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 }}\setup
working-directory: ${{ github.workspace }}\scripts
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/mediaportal-myvideo-importer/v${{steps.version.outputs.version}}/total)](https://github.com/andrewjswan/mediaportal-myvideo-importer/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 }}\setup
working-directory: ${{ github.workspace }}\scripts
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 }}\setup
working-directory: ${{ github.workspace }}\scripts
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: MyVideoImporter Version Description
path: |
Expand All @@ -178,11 +195,13 @@ jobs:
xml:
name: MyVideo Importer / 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 @@ -209,12 +228,14 @@ jobs:

release:
name: MyVideo Importer / 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 @@ -275,7 +296,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
20 changes: 1 addition & 19 deletions scripts/Create_Installer.bat
Original file line number Diff line number Diff line change
Expand Up @@ -13,31 +13,13 @@ if "%programfiles(x86)%XXX"=="XXX" goto 32BIT
IF NOT EXIST "%PROGS%\Team MediaPortal\MediaPortal\" SET PROGS=C:

:: Get version from DLL
FOR /F "tokens=1-3" %%i IN ('Tools\sigcheck.exe -accepteula -nobanner "..\MyVideoImporter\bin\Release\MyVideoImporter.dll"') DO ( IF "%%i %%j"=="File version:" SET version=%%k )

:: trim version
SET version=%version:~0,-1%
FOR /F "tokens=*" %%i IN ('Tools\sigcheck.exe /accepteula /nobanner /n "..\MyVideoImporter\bin\Release\MyVideoImporter.dll"') DO (SET version=%%i)

:: Temp xmp2 file
copy /Y MyVideoImporter.xmp2 MyVideoImporterTemp.xmp2

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

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

:: Cleanup
del MyVideoImporterTemp.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 "..\builds\MyVideoImporter-%major%.%minor%.%build%.%revision%.mpe1" del "..\builds\MyVideoImporter-%major%.%minor%.%build%.%revision%.mpe1"
rename ..\builds\MyVideoImporter-MAJOR.MINOR.BUILD.REVISION.mpe1 "MyVideoImporter-%major%.%minor%.%build%.%revision%.mpe1"
4 changes: 2 additions & 2 deletions scripts/MyVideoImporter.xmp2
Original file line number Diff line number Diff line change
Expand Up @@ -382,11 +382,11 @@ Repo rework, migrating to Github Release

*** We Stand with Ukraine ***</VersionDescription>
<DevelopmentStatus>Stable</DevelopmentStatus>
<OnlineLocation>https://github.com/andrewjswan/mediaportal-myvideo-importer/releases/download/v{VERSION}/MyVideoImporter-{VERSION}.mpe1</OnlineLocation>
<OnlineLocation>https://github.com/andrewjswan/mediaportal-myvideo-importer/releases/download/v[Version]/MyVideoImporter-[Version].mpe1</OnlineLocation>
<ReleaseDate>2024-03-19T17:17:17</ReleaseDate>
<Tags>myvideo, importer</Tags>
<PlatformCompatibility>AnyCPU</PlatformCompatibility>
<Location>..\builds\MyVideoImporter-MAJOR.MINOR.BUILD.REVISION.mpe1</Location>
<Location>..\builds\MyVideoImporter-[Version].mpe1</Location>
<Params>
<Items>
<SectionParam Name="Icon">
Expand Down

0 comments on commit 28fc23e

Please sign in to comment.