Skip to content

Release

Release #16

Workflow file for this run

# This workflow now builds T3000Controls and BACnetStackLibrary components
name: Release
on:
workflow_dispatch:
release:
types: [published]
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
release:
runs-on: windows-latest
environment: webview_build
env:
API_URL: ${{ secrets.API_URL }}
API_WS_URL: ${{ secrets.API_WS_URL }}
LOCAL_API_URL: ${{ vars.LOCAL_API_URL }}
LOCAL_API_SECRET_KEY: ${{ secrets.LOCAL_API_SECRET_KEY }}
API_SECRET_KEY: ${{ secrets.LOCAL_API_SECRET_KEY }}
steps:
- name: checkout
uses: actions/checkout@v4
with:
submodules: recursive
- name: Update submodules
run: |
git submodule update --recursive --remote
- name: Build webview ui
run: |
cd T3000Webview
npm install
npm run build
- name: Setup Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
targets: i686-pc-windows-msvc
- name: Build webview api
run: |
cd T3000Webview/api
cargo build --target=i686-pc-windows-msvc --release
- name: Get T3000 version number
id: version
run: |
$version = '${{ github.event.release.tag_name }}'
$version = $version -replace "[^0-9]"
Write-Output version=$version >> $Env:GITHUB_OUTPUT
- name: Setup MSBuild
uses: microsoft/setup-msbuild@v2
- name: Build Solution
run: |
msbuild "T3000 - VS2019.sln" /p:Platform=x86 /p:Configuration=Release /p:ProjectVersion=${{ steps.version.outputs.version }}
- name: Clean & Orgenize Files
continue-on-error: true
run: |
del "T3000 Output\release\*.pdb"
del "T3000 Output\release\*.lib"
del "T3000 Output\release\*.exp"
del "T3000 Output\release\*.ilk"
del "T3000 Output\release\ReadSinglePropDescr.xml"
del "T3000 Output\release\BacnetExplore.exe.config"
xcopy "T3000Webview\dist\spa\" "T3000 Output\release\ResourceFile\webview\www\" /E /H /C /I /y
xcopy "T3000Webview\api\target\i686-pc-windows-msvc\release\t3_webview_api.dll" "T3000 Output\release\" /Y
xcopy "T3000Webview\api\target\i686-pc-windows-msvc\release\t3_webview_api.dll.lib" "T3000 Output\release\" /Y
- name: Set the installer version ( doesn't accept big numbers so we add a point )
id: iversion
run: |
$iversion = '${{ steps.version.outputs.version }}'
$iversion = $iversion.Insert(4,'.')
Write-Output iversion=$iversion >> $Env:GITHUB_OUTPUT
- name: Build the installer
uses: caphyon/advinst-github-action@main
with:
advinst-version: "20.9"
advinst-enable-automation: "true"
aip-path: ${{ github.workspace }}\T3000.aip
aip-build-name: DefaultBuild
aip-package-name: T3000-setup.msi
aip-output-dir: ${{ github.workspace }}\setup
aip-commands: |
AddFolder "APPDIR" ".\T3000 Output\release" -install_in_parent_folder
AddFolder "APPDIR" ".\T3000InstallShield\PH_Application"
AddFolder "APPDIR" ".\T3000InstallShield\Psychrometry"
SetProductCode -langid 1033
SetVersion ${{ steps.iversion.outputs.iversion }}
- name: Upload the installer file to the release assets
id: releaseFile
uses: shogo82148/actions-upload-release-asset@v1
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: ${{ github.workspace }}\setup\T3000-setup.msi
asset_name: T3000-setup.msi
asset_content_type: application/x-ms-installer
- name: Prepare & zip the update files
run: |
Rename-Item -Path ".\T3000 Output\release\Update.exe" -NewName "UpdateEng.exe"
Compress-Archive -Path ".\T3000 Output\release\*" -CompressionLevel Optimal -DestinationPath .\20T3000Update.zip
- name: Zip the installer file
run: Compress-Archive -Path ".\setup\T3000-setup.msi" -CompressionLevel Optimal -DestinationPath .\09T3000Software.zip
- name: Upload the update file to FTP
uses: SamKirkland/[email protected]
with:
server: sftp://${{ vars.FTP_HOST }}
username: ${{ secrets.FTP_USER }}
password: ${{ secrets.FTP_PASSWORD }}
protocol: 'sftp' # Ensure SFTP protocol is used
local-dir: "./09T3000Software.zip"
server-dir: "/software/"
dry-run: false # Set to false to enable actual file upload
dangerous-clean-slate: false # Prevent deletion of other files
- name: Upload the software installer file to FTP
uses: appleboy/[email protected]
with:
host: ${{ vars.FTP_HOST }}
port: 22
username: ${{ secrets.FTP_USER }}
password: ${{ secrets.FTP_PASSWORD }}
overwrite: true
source: "./20T3000Update.zip"
target: "/software/"
- name: Update T3000 version in the INI file
id: webhookRequest
uses: fjogeleit/http-request-action@v1
with:
url: "${{ vars.T3_VERSION_UPDATER_WEBHOOK_URL }}"
method: "POST"
customHeaders: '{"Content-Type": "application/json", "X-Secret-Key": "${{ secrets.T3_VERSION_UPDATER_WEBHOOK_SECRET }}"}'
data: '{"version": "${{ steps.version.outputs.version }}", "url": "${{ steps.releaseFile.outputs.browser_download_url }}"}'