Skip to content

Commit 304399a

Browse files
committed
Fix RocketModFix.Unturned.Redist.Matrix
1 parent ccbf7e5 commit 304399a

File tree

1 file changed

+48
-31
lines changed

1 file changed

+48
-31
lines changed

.github/workflows/RocketModFix.Unturned.Redist.Matrix.yaml

Lines changed: 48 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
name: RocketModFix.Unturned.Redist.Matrix
22

33
on:
4-
# push:
5-
# branches: [ master ]
6-
# paths:
7-
# - 'redist/redist-*/**'
4+
push:
5+
branches: [ master ]
6+
paths:
7+
- 'redist/redist-*/**'
88
workflow_dispatch:
99
inputs:
1010
variant:
@@ -45,14 +45,14 @@ jobs:
4545
nuspec_path: "redist/redist-client-preview-old/RocketModFix.Unturned.Redist.Client.nuspec"
4646
trigger_path: "redist/redist-client-preview-old/**"
4747
workflow_trigger: "Update Unturned Redist for Client Preview Old"
48-
#- variant: "client-preview-publicized"
49-
# nuspec_path: "redist/redist-client-preview-publicized/RocketModFix.Unturned.Redist.Client.nuspec"
50-
# trigger_path: "redist/redist-client-preview-publicized/**"
51-
# workflow_trigger: "Update Unturned Redist for Client Preview"
52-
#- variant: "client-publicized"
53-
# nuspec_path: "redist/redist-client-publicized/RocketModFix.Unturned.Redist.Client.nuspec"
54-
# trigger_path: "redist/redist-client-publicized/**"
55-
# workflow_trigger: "Update Unturned Redist for Client Publicized"
48+
- variant: "client-preview-publicized"
49+
nuspec_path: "redist/redist-client-preview-publicized/RocketModFix.Unturned.Redist.Client.nuspec"
50+
trigger_path: "redist/redist-client-preview-publicized/**"
51+
workflow_trigger: "Update Unturned Redist for Client Preview"
52+
- variant: "client-publicized"
53+
nuspec_path: "redist/redist-client-publicized/RocketModFix.Unturned.Redist.Client.nuspec"
54+
trigger_path: "redist/redist-client-publicized/**"
55+
workflow_trigger: "Update Unturned Redist for Client Publicized"
5656

5757
# Server variants
5858
- variant: "server"
@@ -67,34 +67,51 @@ jobs:
6767
nuspec_path: "redist/redist-server-preview-old/RocketModFix.Unturned.Redist.Server.nuspec"
6868
trigger_path: "redist/redist-server-preview-old/**"
6969
workflow_trigger: "Update Unturned Redist for Server Preview Old"
70-
#- variant: "server-preview-publicized"
71-
# nuspec_path: "redist/redist-server-preview-publicized/RocketModFix.Unturned.Redist.Server.nuspec"
72-
# trigger_path: "redist/redist-server-preview-publicized/**"
73-
# workflow_trigger: "Update Unturned Redist for Server Preview"
74-
#- variant: "server-publicized"
75-
# nuspec_path: "redist/redist-server-publicized/RocketModFix.Unturned.Redist.Server.nuspec"
76-
# trigger_path: "redist/redist-server-publicized/**"
77-
# workflow_trigger: "Update Unturned Redist for Server Publicized"
78-
79-
# Only run if this is a workflow_dispatch with a specific variant or "all", or if the path matches
80-
if: |
81-
github.event_name == 'workflow_dispatch' &&
82-
(github.event.inputs.variant == 'all' || github.event.inputs.variant == matrix.variant) ||
83-
github.event_name == 'push' && contains(toJSON(github.event.commits[0].modified), matrix.trigger_path) ||
84-
github.event_name == 'workflow_run' && github.event.workflow_run.name == matrix.workflow_trigger
70+
- variant: "server-preview-publicized"
71+
nuspec_path: "redist/redist-server-preview-publicized/RocketModFix.Unturned.Redist.Server.nuspec"
72+
trigger_path: "redist/redist-server-preview-publicized/**"
73+
workflow_trigger: "Update Unturned Redist for Server Preview"
74+
- variant: "server-publicized"
75+
nuspec_path: "redist/redist-server-publicized/RocketModFix.Unturned.Redist.Server.nuspec"
76+
trigger_path: "redist/redist-server-publicized/**"
77+
workflow_trigger: "Update Unturned Redist for Server Publicized"
8578

8679
steps:
8780
- name: Checkout code
8881
uses: actions/checkout@v4
8982

90-
- uses: nuget/setup-nuget@v2
91-
name: Setup NuGet
83+
- name: Determine if this variant should run
84+
id: check
85+
run: |
86+
SHOULD_RUN=false
87+
88+
if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then
89+
if [[ "${{ github.event.inputs.variant }}" == "all" || "${{ github.event.inputs.variant }}" == "${{ matrix.variant }}" ]]; then
90+
SHOULD_RUN=true
91+
fi
92+
elif [[ "${{ github.event_name }}" == "push" ]]; then
93+
if echo '${{ toJSON(github.event.commits[0].modified) }}' | grep -qE "${{ matrix.trigger_path }}"; then
94+
SHOULD_RUN=true
95+
fi
96+
elif [[ "${{ github.event_name }}" == "workflow_run" ]]; then
97+
if [[ "${{ github.event.workflow_run.name }}" == "${{ matrix.workflow_trigger }}" ]]; then
98+
SHOULD_RUN=true
99+
fi
100+
fi
101+
102+
echo "should_run=$SHOULD_RUN" >> $GITHUB_OUTPUT
103+
104+
- name: Setup NuGet
105+
if: steps.check.outputs.should_run == 'true'
106+
uses: nuget/setup-nuget@v2
92107
with:
93108
nuget-api-key: ${{ secrets.NUGET_DEPLOY_KEY }}
94109

95-
- uses: ./.github/actions/nuget-pack
110+
- name: NuGet Pack & Push
111+
if: steps.check.outputs.should_run == 'true'
112+
uses: ./.github/actions/nuget-pack
96113
id: nuget-pack
97114
with:
98115
nuspec_path: ${{ matrix.nuspec_path }}
99116
nuget_key: ${{ secrets.NUGET_DEPLOY_KEY }}
100-
nuget_push: true
117+
nuget_push: true

0 commit comments

Comments
 (0)