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 a9a9545 commit dd34edf
Showing 1 changed file with 31 additions and 10 deletions.
41 changes: 31 additions & 10 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: mvCentral 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 "mvCentral.xml" "//Items/PackageClass/GeneralInfo/VersionDescription" last > description.txt
working-directory: ${{ github.workspace }}\MPEI
shell: cmd

- name: Clean Release Version Description
if: ${{ success() && contains(github.event.head_commit.message, '[release]') }}
if: ${{ success() && needs.changes.outputs.changes == 'true' }}
run: |
..\MPE\Tools\sed.exe -i "s/\*\*\* We Stand with Ukraine \*\*\*//g" description.txt
working-directory: ${{ github.workspace }}\MPEI
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/mvcentral/v${{steps.version.outputs.version}}/total)](https://github.com/andrewjswan/mvcentral/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 }}\MPEI
shell: cmd

- name: Clean Release Version Description
if: ${{ success() && contains(github.event.head_commit.message, '[release]') }}
if: ${{ success() && needs.changes.outputs.changes == 'true' }}
run: |
..\MPE\Tools\sed.exe -i "s/ \//\//g" description.txt
working-directory: ${{ github.workspace }}\MPEI
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: mvCentral Version Description
path: |
Expand All @@ -178,11 +195,13 @@ jobs:
xml:
name: mvCentral Plugin / 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: mvCentral Plugin / 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

0 comments on commit dd34edf

Please sign in to comment.