Skip to content

Build and Release Cyanite #8

Build and Release Cyanite

Build and Release Cyanite #8

name: Build and Release Cyanite
on:
workflow_dispatch:
push:
tags:
- 'v*' # Trigger this action on new tags (e.g., v1.0.0)
jobs:
build:
defaults:
run:
shell: bash
working-directory: ./server
runs-on: windows-latest
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.22'
- name: Install MinGW (GCC)
run: |
choco install mingw -y
- name: Build Go Application
run: |
mkdir -p installer
go build -ldflags="-H windowsgui" -o installer/cyanite.exe
- name: Set up Inno Setup
run: |
choco install innosetup -y
- name: Set Version in Inno Setup Script
run: |
cd installer
# Extract version from GITHUB_REF (refs/tags/v1.0.0 -> 1.0.0)
if [[ "${GITHUB_REF}" == refs/tags/* ]]; then
VERSION=${GITHUB_REF#refs/tags/}
VERSION=${VERSION#v}
else
VERSION="0.0.0" # Default version if no tag
fi
# Replace {#AppVersion} in setup.iss
powershell -Command "(Get-Content setup.iss) -replace '{#AppVersion}', '$VERSION' | Set-Content setup.iss"
echo "Version set to: $VERSION"
- name: Create Installer with Inno Setup
run: |
cd installer
"C:\Program Files (x86)\Inno Setup 6\ISCC.exe" setup.iss
- name: Upload Installer as Artifact
uses: actions/upload-artifact@v4
with:
name: CyaniteInstaller
path: installer/Output/Cyanite-Win64-Setup.exe
release:
needs: build
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Download Installer Artifact
uses: actions/download-artifact@v4
with:
name: CyaniteInstaller
path: ./installer
- name: Generate Changelog
run: |
if [[ "${GITHUB_REF}" == refs/tags/* ]]; then
VERSION=${GITHUB_REF#refs/tags/}
else
VERSION="0.0.0" # Default version if no tag
fi
PREVIOUS_VERSION=$(git describe --tags --abbrev=0 "${GITHUB_SHA}^" 2>/dev/null || echo "Initial")
CHANGELOG=$(git log --oneline "${PREVIOUS_VERSION}".."${GITHUB_SHA}" 2>/dev/null || echo "No changes found.")
echo "Changelog generated for version $VERSION:" > changelog.txt
echo "$CHANGELOG" >> changelog.txt
cat changelog.txt
- name: Create GitHub Release (Draft)
uses: softprops/action-gh-release@v2
with:
files: installer/Cyanite-Win64-Setup.exe
body: |
$(cat changelog.txt)
draft: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}