Skip to content

Commit f6a26e4

Browse files
committed
[actions] Skip installer build if only metadata changed
1 parent d82d793 commit f6a26e4

File tree

1 file changed

+28
-1
lines changed

1 file changed

+28
-1
lines changed

.github/workflows/test_and_deploy.yml

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,33 @@ 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+
# Download the repository
38+
- uses: actions/checkout@v4
39+
40+
# For pull requests it's not necessary to checkout the code
41+
- uses: dorny/paths-filter@v3
42+
id: filter
43+
with:
44+
filters: |
45+
build-installer:
46+
- '!((installData.json)|(versionData.json)|(cachedDownloadSizes.json))'
47+
2648
# Windows Build
2749
windows_build:
2850
name: Windows Build
51+
needs: changes
52+
if: ${{ needs.changes.outputs.build-installer == 'true' }}
2953
runs-on: windows-latest
3054
strategy:
3155
matrix:
@@ -82,7 +106,8 @@ jobs:
82106
# Linux/Mac Build
83107
linux_mac_build:
84108
name: Linux and Mac Build
85-
needs: windows_build
109+
if: ${{ always() }} # Always run this, even if windows_build or other tasks fail
110+
needs: [windows_build, changes]
86111
runs-on: ubuntu-latest
87112
strategy:
88113
matrix:
@@ -116,13 +141,15 @@ jobs:
116141

117142
# Download Windows artifacts
118143
- name: Download all Windows .exe artifacts
144+
if: ${{ needs.changes.outputs.build-installer == 'true' }}
119145
uses: actions/download-artifact@v4
120146
with:
121147
name: windows-loader-exe
122148
path: travis_installer_output
123149

124150
# Run Python Deploy Script
125151
- name: Run Deploy Script
152+
if: ${{ needs.changes.outputs.build-installer == 'true' }}
126153
run: python travis_build_script.py
127154

128155
# Publish a release (tagged commits)

0 commit comments

Comments
 (0)