Skip to content

Release

Release #7

Workflow file for this run

name: Release
on:
workflow_dispatch:
inputs:
version:
description: 'Version number for release'
required: true
default: '0.0.0'
jobs:
build-windows:
runs-on: windows-latest
outputs:
installer_name: ${{ steps.get_installer_name.outputs.name }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: "8.0.*"
- name: Update version in csproj
run: |
sed -i 's#<Version>.*</Version>#<Version>${{ github.event.inputs.version }}</Version>#' *.csproj
- name: Update version in iss file
run: |
sed -i 's/#define AppVersion ".*"/#define AppVersion "${{ github.event.inputs.version }}"/' .winbuild/ChemLocalLink.iss
- name: Restore dependencies
run: dotnet restore
- name: Build
run: dotnet build --no-restore
- name: Test
run: dotnet test --no-build --verbosity normal
- name: Publish project
run: |
dotnet publish -p:PublishSingleFile=true --self-contained false
ren "bin\Release\net8.0-windows10.0.17763.0\win-x64\publish\ChemLocalLink.exe" "ChemLocalLink.exe"
- name: Build Installer
uses: Minionguyjpro/Inno-Setup-Action@v1.2.2
with:
path: .winbuild/ChemLocalLink.iss
- name: Get Installer Info
id: get_installer_name
shell: pwsh
run: |
$installer_path = "C:/app/build/ChemLocalLink-${{ github.event.inputs.version }}.exe"
$installer_name = "ChemLocalLink_${{ github.event.inputs.version }}.exe"
echo "path=$installer_path" | Out-File -FilePath $env:GITHUB_OUTPUT -Encoding utf8 -Append
echo "name=$installer_name" | Out-File -FilePath $env:GITHUB_OUTPUT -Encoding utf8 -Append
- name: Upload Installer as Artifact
uses: actions/upload-artifact@v4
with:
name: windows-installer
path: ${{ steps.get_installer_name.outputs.path }}
build-linux:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: "8.0.*"
- name: Update version in csproj
run: |
sed -i 's#<Version>.*</Version>#<Version>${{ github.event.inputs.version }}</Version>#' ChemLocalLink.csproj
- name: Build Debian package
run: |
chmod +x .unixbuild/build-deb.sh
./.unixbuild/build-deb.sh --clean
- name: Upload Debian packages as Artifact
uses: actions/upload-artifact@v4
with:
name: debian-packages
path: .unixbuild/build/*.deb
create-release:
runs-on: ubuntu-latest
needs: [build-windows, build-linux]
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Create GitHub Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: v${{ github.event.inputs.version }}
release_name: ${{ github.event.inputs.version }}
body: |
Release of version ${{ github.event.inputs.version }}.
draft: false
prerelease: false
- name: Download Windows installer artifact
uses: actions/download-artifact@v4
with:
name: windows-installer
path: /tmp/windows-installer
- name: Download Debian packages artifact
uses: actions/download-artifact@v4
with:
name: debian-packages
path: /tmp/debian-packages
- name: Prepare Windows asset rename
run: |
mv /tmp/windows-installer/ChemLocalLink-${{ github.event.inputs.version }}.exe /tmp/windows-installer/${{ needs.build-windows.outputs.installer_name }}
- name: Upload Release Assets (Windows + Debian)
run: |
version=${{ github.event.inputs.version }}
gh release upload "v${version}" /tmp/windows-installer/${{ needs.build-windows.outputs.installer_name }} --clobber
for file in /tmp/debian-packages/*.deb; do
gh release upload "v${version}" "$file" --clobber
done
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}