Skip to content

Commit

Permalink
ci: change build script (#451)
Browse files Browse the repository at this point in the history
  • Loading branch information
al-kau authored Nov 21, 2024
1 parent a81466e commit 64391a4
Showing 1 changed file with 23 additions and 19 deletions.
42 changes: 23 additions & 19 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@
---

name: "Build solution"
run-name: >-
${{ github.event_name == 'schedule' && 'Build All' || '' }}
${{ github.event_name == 'workflow_dispatch' && format('Build: {0} ({1}) on {2} OS', github.event.inputs.framework, github.event.inputs.configuration, github.event.inputs.os ) || '' }}
on: # yamllint disable-line rule:truthy
workflow_dispatch:
Expand Down Expand Up @@ -74,24 +77,25 @@ jobs:
with:
fetch-depth: 0

- name: Initializing default keywords
if: github.event_name != 'workflow_dispatch'
- name: Initializing config keywords
shell: bash
run: |
echo "BUILD_CONFIG_KEYWORDS=autobuild" >> $GITHUB_ENV
keywords="autobuild"
- name: Read input keywords
if: github.event_name == 'workflow_dispatch'
shell: bash
run: |
echo "BUILD_CONFIG_KEYWORDS=${{ github.event.inputs.framework }},${{ github.event.inputs.os }}" >> $GITHUB_ENV
if [[ ${{ github.event_name }} == 'schedule' ]]; then
keywords="all"
elif [[ ${{ github.event_name }} == 'workflow_dispatch' ]]; then
keywords="${{ github.event.inputs.framework }},${{ github.event.inputs.os }}"
fi
echo "EPPIE_BUILD_CONFIG_KEYWORDS=$keywords" >> $GITHUB_ENV
- name: Select Build config
id: build-config
uses: finebits/github-actions/toolset/select-configuration@4a126d80a11c5fdc83ce884d3d23dffb30bc4495 # v2.0.0
with:
json-file: ./.github/configurations/build.json
keywords: ${{ env.BUILD_CONFIG_KEYWORDS }}
keywords: ${{ env.EPPIE_BUILD_CONFIG_KEYWORDS }}

- name: Check configs
shell: bash
Expand All @@ -116,13 +120,13 @@ jobs:
- name: Initializing configuration
shell: bash
run: |
echo "BUILD_CONFIGURATION=${{ matrix.build.configuration }}" >> $GITHUB_ENV
configuration="${{ matrix.build.configuration }}"
- name: Read input configuration
if: github.event_name == 'workflow_dispatch'
shell: bash
run: |
echo "BUILD_CONFIGURATION=${{ github.event.inputs.configuration }}" >> $GITHUB_ENV
if [[ ${{ github.event_name }} == 'workflow_dispatch' ]]; then
configuration="${{ github.event.inputs.configuration }}"
fi
echo "EPPIE_BUILD_CONFIGURATION=$configuration" >> $GITHUB_ENV
- name: Support longpaths
if: ${{ runner.os == 'Windows'}}
Expand Down Expand Up @@ -158,24 +162,24 @@ jobs:
msbuild -target:Restore $extra_options $project
- name: Build via dotnet
- name: Build via dotnet (${{ env.EPPIE_BUILD_CONFIGURATION }})
if: matrix.build.tool == 'dotnet'
shell: bash
run: |
project='${{ matrix.build.project }}'
configuration='${{ env.BUILD_CONFIGURATION }}'
configuration='${{ env.EPPIE_BUILD_CONFIGURATION }}'
extra_options='${{ matrix.build.extra }}'
framework='${{ matrix.build.framework }}'
framework_option=$([ "$framework" != "" ] && echo "--framework=$framework" || echo "")
dotnet build --configuration=$configuration $framework_option $extra_options $project
- name: Build via msbuild
- name: Build via msbuild (${{ env.EPPIE_BUILD_CONFIGURATION }})
if: matrix.build.tool == 'msbuild' && runner.os == 'Windows'
shell: pwsh
run: |
$project='${{ matrix.build.project }}'
$configuration='${{ env.BUILD_CONFIGURATION }}'
$configuration='${{ env.EPPIE_BUILD_CONFIGURATION }}'
$extra_options=$('${{ matrix.build.extra }}' -split '\s+')
$framework='${{ matrix.build.framework }}'
$framework_option=$( if($framework) {"-property:TargetFramework=$framework"} else {""} )
Expand Down

0 comments on commit 64391a4

Please sign in to comment.