Refactor GitHub Actions workflow for conditional builds
- Removed redundant conditional checks for build jobs. - Introduced a new step to determine if the build should run based on event type and input parameters. - Updated job definitions to utilize the new build input logic for Windows, macOS, and Linux builds.
This commit is contained in:
29
.github/workflows/build.yml
vendored
29
.github/workflows/build.yml
vendored
@@ -69,16 +69,6 @@ jobs:
|
|||||||
name: Build Desktop (${{ matrix.name }})
|
name: Build Desktop (${{ matrix.name }})
|
||||||
needs: build_frontend
|
needs: build_frontend
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
if: |
|
|
||||||
github.event_name == 'push' ||
|
|
||||||
(
|
|
||||||
github.event_name == 'workflow_dispatch' &&
|
|
||||||
(
|
|
||||||
(matrix.name == 'windows' && github.event.inputs.build_windows == 'true') ||
|
|
||||||
(matrix.name == 'mac' && github.event.inputs.build_mac == 'true') ||
|
|
||||||
(matrix.name == 'linux' && github.event.inputs.build_linux == 'true')
|
|
||||||
)
|
|
||||||
)
|
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
@@ -88,20 +78,39 @@ jobs:
|
|||||||
node: 22
|
node: 22
|
||||||
python: "3.12"
|
python: "3.12"
|
||||||
release_artifacts: "dist/*-win-installer.exe,dist/*-win-portable.exe"
|
release_artifacts: "dist/*-win-installer.exe,dist/*-win-portable.exe"
|
||||||
|
build_input: build_windows
|
||||||
- name: mac
|
- name: mac
|
||||||
os: macos-13
|
os: macos-13
|
||||||
node: 18
|
node: 18
|
||||||
python: "3.11"
|
python: "3.11"
|
||||||
release_artifacts: "dist/*-mac.dmg"
|
release_artifacts: "dist/*-mac.dmg"
|
||||||
|
build_input: build_mac
|
||||||
- name: linux
|
- name: linux
|
||||||
os: ubuntu-latest
|
os: ubuntu-latest
|
||||||
node: 22
|
node: 22
|
||||||
python: "3.12"
|
python: "3.12"
|
||||||
release_artifacts: "dist/*-linux.AppImage,dist/*-linux.deb,python-dist/*.whl"
|
release_artifacts: "dist/*-linux.AppImage,dist/*-linux.deb,python-dist/*.whl"
|
||||||
|
build_input: build_linux
|
||||||
permissions:
|
permissions:
|
||||||
contents: write
|
contents: write
|
||||||
steps:
|
steps:
|
||||||
|
- name: Check if build should run
|
||||||
|
id: should_build
|
||||||
|
run: |
|
||||||
|
if [ "${{ github.event_name }}" = "push" ]; then
|
||||||
|
echo "should_run=true" >> $GITHUB_OUTPUT
|
||||||
|
elif [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
|
||||||
|
if [ "${{ github.event.inputs[matrix.build_input] }}" = "true" ]; then
|
||||||
|
echo "should_run=true" >> $GITHUB_OUTPUT
|
||||||
|
else
|
||||||
|
echo "should_run=false" >> $GITHUB_OUTPUT
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo "should_run=false" >> $GITHUB_OUTPUT
|
||||||
|
fi
|
||||||
|
|
||||||
- name: Clone Repo
|
- name: Clone Repo
|
||||||
|
if: steps.should_build.outputs.should_run == 'true'
|
||||||
uses: actions/checkout@50fbc622fc4ef5163becd7fab6573eac35f8462e # v1
|
uses: actions/checkout@50fbc622fc4ef5163becd7fab6573eac35f8462e # v1
|
||||||
|
|
||||||
- name: Install NodeJS
|
- name: Install NodeJS
|
||||||
|
|||||||
Reference in New Issue
Block a user