Skip to content

Package

Package #342

Workflow file for this run

name: Package
on:
workflow_dispatch:
inputs:
version:
description: "The version to release (eg: 'v1.0.0')"
required: true
type: string
create-artifacts:
description: "Create artifacts?"
required: true
type: boolean
default: true
use-codesigning:
description: "Use codesigning?"
required: false
type: boolean
default: true
release:
description: "Create a draft release?"
required: false
type: boolean
default: true
staging-release:
description: "Create a draft staging release?"
required: false
type: boolean
default: true
jobs:
build:
runs-on: windows-latest
env:
NO_PARALLEL: true
ES_USERNAME: ${{ secrets.ES_USERNAME }}
ES_PASSWORD: ${{ secrets.ES_PASSWORD }}
ES_CREDENTIAL_ID: ${{ secrets.ES_CREDENTIAL_ID }}
ES_TOTP_SECRET: ${{ secrets.ES_TOTP_SECRET }}
NEXUS_API_KEY: ${{ secrets.NEXUS_API_KEY }}
ACTIONS_ALLOW_UNSECURE_COMMANDS: true # Allows AddPAth and SetEnv commands
CERT_PATH: Release
VORTEX_BUILD_CONFIG: Release # Could just use CERT_PATH but this is more explicit
DEBUG: electron-builder # gives electron more verbose logs
steps:
- name: Show Inputs
run: echo "${{ toJSON(github.event.inputs) }}"
- name: Set Outputs
id: setOutputs
shell: pwsh
env:
InputVersion: ${{ inputs.version }}
GITHUB_RUN_NUMBER: ${{ github.run_number }}
run: |
$semverRegex = '^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$'
$tagVersion = If ($env:InputVersion.StartsWith('v')) {$env:InputVersion} Else {"v" + $env:InputVersion}
$rawVersion = If ($env:InputVersion.StartsWith('v')) {$env:InputVersion.Substring(1)} Else {$env:InputVersion}
# validation
If ($rawVersion -notmatch $semverRegex) {
Write-Error "Invalid version format. Must be semver."
Exit 1
}
echo "tagVersion=$tagVersion" >> $env:GITHUB_OUTPUT
echo "rawVersion=$rawVersion" >> $env:GITHUB_OUTPUT
echo "artifactNameUnpacked=vortex-setup-$rawVersion-unpacked" >> $env:GITHUB_OUTPUT
echo "artifactNameInstaller=vortex-setup-$rawVersion-installer" >> $env:GITHUB_OUTPUT
echo "epicBuildString=$rawVersion+$env:GITHUB_RUN_NUMBER" >> $env:GITHUB_OUTPUT
echo "epicBuildString=$rawVersion+$env:GITHUB_RUN_NUMBER"
- name: Get current time
uses: josStorer/get-current-time@v2
id: current-time
with:
format: 'YYYY-MM-DD HHmm'
- name: Use current time
env:
TIME: "${{ steps.current-time.outputs.time }}"
R_TIME: "${{ steps.current-time.outputs.readableTime }}"
F_TIME: "${{ steps.current-time.outputs.formattedTime }}"
YEAR: "${{ steps.current-time.outputs.year }}"
DAY: "${{ steps.current-time.outputs.day }}"
run: echo $TIME $R_TIME $F_TIME $YEAR $DAY
- uses: actions/checkout@v5
with:
submodules: "recursive"
- uses: actions/setup-dotnet@v5
with:
dotnet-version: '9.0.x'
- name: Print dotnet info
run: dotnet --info
- name: Download Microsoft Visual C++ Redistributable
shell: pwsh
run: |
Invoke-WebRequest -Uri "https://aka.ms/vs/17/release/vc_redist.x64.exe" -OutFile "build\\VC_redist.x64.exe"
- name: Download .NET 9 Runtime
shell: pwsh
run: |
Invoke-WebRequest -Uri "https://aka.ms/dotnet/9.0/windowsdesktop-runtime-win-x64.exe" -OutFile "build\\windowsdesktop-runtime-win-x64.exe"
- name: Download CodeSignTool
id: codesign
shell: pwsh
run: .\download-codesigntool.ps1
- name: Read Node.js version from package.json
id: node-version
shell: pwsh
run: |
$packageJson = Get-Content package.json | ConvertFrom-Json
$nodeVersion = $packageJson.engines.node
echo "NODE_VERSION=$nodeVersion" >> $env:GITHUB_OUTPUT
echo "Using Node.js version: $nodeVersion"
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ steps.node-version.outputs.NODE_VERSION }}
cache: "yarn"
- name: Install dependencies
run: yarn --non-interactive install
- name: Build API
run: yarn --non-interactive build_api
- name: Install Production Dependencies
run: yarn --non-interactive _install_app
- name: Build Extensions (Submodules)
run: yarn --non-interactive subprojects_app_ci
- name: Build Static Assets
run: yarn --non-interactive _assets_app
- name: Bundle Application (Webpack)
run: yarn build_dist
- name: Test
run: yarn test
- name: Create Signed Installer
if: ${{ inputs.use-codesigning == true }}
run: yarn package
- name: Create Unsigned Installer
if: ${{ inputs.use-codesigning == false }}
run: yarn package:nocodesign
- name: Extract Debug Sourcemaps
run: yarn extract_sourcemaps
- name: Validate Package Creation
shell: pwsh
run: |
$installerExists = Test-Path "./dist/vortex-setup-*.*.*.exe"
$latestYmlExists = Test-Path "./dist/latest.yml"
if (-not $installerExists) {
Write-Error "Installer executable not found in ./dist/"
exit 1
}
if (-not $latestYmlExists) {
Write-Error "latest.yml not found in ./dist/"
exit 1
}
Write-Output "✅ Package validation successful - installer and metadata files created"
- name: Create GitHub Release
uses: softprops/action-gh-release@v2.2.2
if: ${{ inputs.release == true }}
with:
files: |
./dist/vortex-setup-*.*.*.exe
./dist/latest.yml
./dist/alpha.yml
./dist/beta.yml
prerelease: true
draft: true
name: ${{ steps.setOutputs.outputs.rawVersion }}
tag_name: ${{ steps.setOutputs.outputs.tagVersion }}
- name: Create GitHub Release on Vortex-Staging
uses: softprops/action-gh-release@v2.2.2
if: ${{ inputs.staging-release == true }}
with:
files: |
./dist/vortex-setup-*.*.*.exe
./dist/latest.yml
./dist/alpha.yml
./dist/beta.yml
prerelease: true
draft: true
name: ${{ steps.setOutputs.outputs.rawVersion }}
tag_name: ${{ steps.setOutputs.outputs.tagVersion }}
token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
repository: "Nexus-Mods/Vortex-Staging"
- name: Create Unpacked Artifact
uses: actions/upload-artifact@v4
if: ${{ inputs.create-artifacts == true }}
with:
name: ${{ steps.setOutputs.outputs.artifactNameUnpacked }}
path: ./dist/win-unpacked
if-no-files-found: error
- name: Create Installer Artifact
uses: actions/upload-artifact@v4
if: ${{ inputs.create-artifacts == true }}
with:
name: ${{ steps.setOutputs.outputs.artifactNameInstaller }}
path: |
./dist/vortex-setup-*.*.*.exe
./dist/latest.yml
if-no-files-found: error