Skip to content

GHA tweaks - only build installer on v tag #9

GHA tweaks - only build installer on v tag

GHA tweaks - only build installer on v tag #9

name: Solid - Build, Test, Installer, Release
on:
push:
jobs:
build-and-test:
name: Build Debug and Run Tests
# note that the older .Net 4.6.1 isn't installed on windows-latest anymore
# see https://github.com/actions/runner-images/issues/5055
runs-on: windows-2019
steps:
- uses: actions/checkout@v4
- uses: microsoft/setup-msbuild@v2
# These deps never change so we cache them to speed up the GHA build. As we move to all deps in nuget, we should remove these lines
# and allow nuget to manage caching
- uses: actions/cache@v4
id: cache-nuget
with:
path: src\packages
key: ${{ runner.os }}-nuget-${{ hashFiles('src/SolidGui/packages.config') }} # hash of one packages.config (there are others)
- name: Restore NuGet Packages
if: ${{ steps.cache-nuget.outputs.cache-hit != 'true' }}
working-directory: src
run: nuget restore
- name: Inspect packages dir
shell: bash
working-directory: src/packages
run: find .
- uses: actions/cache@v4
id: cache-teamcity
with:
path: lib
key: ${{ runner.os }}-teamcity-${{ hashFiles('build/getDependencies-windows.sh') }}
- name: Get Dependencies from TeamCity
if: ${{ steps.cache-teamcity.outputs.cache-hit != 'true' }}
shell: bash
working-directory: build
run: ./getDependencies-windows.sh
- name: Inspect lib dir
shell: bash
working-directory: lib
run: find .
# NUnit tests are only built with debug configuration
- name: Build Solid for NUnit tests
run: msbuild /p:Configuration=Debug /p:Platform=x86 src/solid.sln
- name: Install NUnit.Runner
run: nuget install NUnit.Runners -Version 2.6.4 -DirectDownload -OutputDirectory .
- name: Inspect root dir
shell: bash
run: find .
# tried but couldn't get NUnit tests running in GHA - cjh
# - name: Run NUnit Tests
# working-directory: output/x86/Debug
# run: ../../../NUnit.Runners.2.6.4/tools/nunit-console.exe ./SolidGui.Tests.dll
# clear output directory
# build for release ?
build-installer:
name: Build Release And Make Installer
needs: build-and-test
if: startsWith(github.ref, 'refs/tags/v')
runs-on: windows-2019
steps:
- uses: actions/checkout@v4
- uses: microsoft/setup-msbuild@v2
# nuget and TC dependencies come from the cache
- uses: actions/cache@v4
with:
path: src\packages
key: ${{ runner.os }}-nuget-${{ hashFiles('src/SolidGui/packages.config') }} # hash of one packages.config (there are others)
- uses: actions/cache@v4
with:
path: lib
key: ${{ runner.os }}-teamcity-${{ hashFiles('build/getDependencies-windows.sh') }}
- name: Build Solid for Release
run: msbuild /p:Configuration=Release src/solid.sln
- name: Build Installer
run: iscc installer/setup.iss
- uses: actions/upload-artifact@v4
with:
name: SolidInstaller.exe
path: installer\Output\SolidInstaller.exe
if-no-files-found: error
sign-installer:
name: Sign SOLID installer
needs: build-installer
if: startsWith(github.ref, 'refs/tags/v')
uses: sillsdev/codesign/.github/workflows/sign.yml@v1
with:
target: SolidInstaller.exe
secrets:
certificate: ${{ secrets.CODESIGN_LSDEVSECTIGOEV }}
create-release:
name: Create Release
needs: sign-installer
if: startsWith(github.ref, 'refs/tags/v')
runs-on: windows-latest
steps:
- uses: actions/download-artifact@v4
with:
name: SolidInstaller.exe
- name: Create Release
uses: softprops/action-gh-release@v2
with:
files: SolidInstaller.exe
body: |
Release for version ${{ github.ref }}
draft: true