Skip to content

GHA automatic releases #1

GHA automatic releases

GHA automatic releases #1

name: Solid - Build, Test, Installer, Release
on:
push:
jobs:
build-and-test:
name: Build 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
# the caching mechanism below and the corresponding "if" conditions for nuget and TC dependencies is sort of a hack
# 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 (remove "if" condition statements)
- uses: actions/cache@v4
with:
path: |
src\packages
lib
key: ${{ runner.os }}-nuget-${{ hashFiles('src/SolidGui/packages.config') }} # hash of one packages.config (there are others)
- name: Restore NuGet packages
if: ${{ hashFiles('src/packages/repositories.config') == '' }}
working-directory: src
run: nuget restore
- name: inspect packages dir
shell: bash
working-directory: src/packages
run: find .
- name: Get dependencies from TeamCity
if: ${{ hashFiles('lib/SIL.Core.dll') == '' }}
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 .
# - 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 ?
- name: Capture build artifacts
uses: actions/upload-artifact@v4
with:
name: solid-buildoutput
path: |
output/
lib/
if-no-files-found: error
retention-days: 1
installer:
name: Make installer
needs: build-and-test
runs-on: windows-2019
steps:
- uses: actions/checkout@v4
- uses: microsoft/setup-msbuild@v2
- uses: actions/cache@v4
with:
path: |
src\packages
lib
key: ${{ runner.os }}-nuget-${{ hashFiles('src/SolidGui/packages.config') }} # hash of one packages.config (there are others)
# nuget and TC dependencies come from the cache
- name: Build Solid for Release
run: msbuild /p:Configuration=Release src/solid.sln
- name: Build Installer
run: iscc installer/setup.iss
- name: Save installer as artifact
uses: actions/upload-artifact@v4
with:
name: solid-installer
path: installer\Output\SolidInstaller.exe
if-no-files-found: error
create-release:
name: Create release
needs: installer
runs-on: ubuntu-latest
# if: startsWith(github.ref, 'refs/tags/v')
steps:
- uses: actions/download-artifact@v4
with:
name: solid-installer
- name: Display structure of downloaded files
run: ls -R
- name: Create Release
uses: softprops/action-gh-release@v2
with:
files: SolidInstaller.exe
body: |
Release for version ${{ github.ref }}
draft: true