Skip to content

Commit 225a170

Browse files
committed
[actions] Try skip installer build if certain files change
1 parent d82d793 commit 225a170

File tree

1 file changed

+25
-1
lines changed

1 file changed

+25
-1
lines changed

.github/workflows/test_and_deploy.yml

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,30 @@ on:
2323

2424
# Docs on sharing data between jobs (between VMs): https://help.github.com/en/actions/configuring-and-managing-workflows/persisting-workflow-data-using-artifacts#passing-data-between-jobs-in-a-workflow
2525
jobs:
26+
# This job checks which files have changed, and skips building the installer if only the metadata has changed.
27+
# Modified from example at https://github.com/dorny/paths-filter#examples
28+
changes:
29+
runs-on: ubuntu-latest
30+
# Required permissions
31+
permissions:
32+
pull-requests: read
33+
# Set job outputs to values from filter step
34+
outputs:
35+
build-installer: ${{ github.event_name == 'workflow_dispatch' || startsWith(github.ref, 'refs/tags/') || steps.filter.outputs.build-installer }}
36+
steps:
37+
# For pull requests it's not necessary to checkout the code
38+
- uses: dorny/paths-filter@v3
39+
id: filter
40+
with:
41+
filters: |
42+
build-installer:
43+
- '!((installData.json)|(versionData.json)|(cachedDownloadSizes.json))'
44+
2645
# Windows Build
2746
windows_build:
2847
name: Windows Build
48+
needs: changes
49+
if: ${{ needs.changes.outputs.build-installer == 'true' }}
2950
runs-on: windows-latest
3051
strategy:
3152
matrix:
@@ -82,7 +103,8 @@ jobs:
82103
# Linux/Mac Build
83104
linux_mac_build:
84105
name: Linux and Mac Build
85-
needs: windows_build
106+
if: ${{ always() }} # Always run this, even if windows_build or other tasks fail
107+
needs: [windows_build, changes]
86108
runs-on: ubuntu-latest
87109
strategy:
88110
matrix:
@@ -116,13 +138,15 @@ jobs:
116138

117139
# Download Windows artifacts
118140
- name: Download all Windows .exe artifacts
141+
if: ${{ needs.changes.outputs.build-installer == 'true' }}
119142
uses: actions/download-artifact@v4
120143
with:
121144
name: windows-loader-exe
122145
path: travis_installer_output
123146

124147
# Run Python Deploy Script
125148
- name: Run Deploy Script
149+
if: ${{ needs.changes.outputs.build-installer == 'true' }}
126150
run: python travis_build_script.py
127151

128152
# Publish a release (tagged commits)

0 commit comments

Comments
 (0)