Skip to content

chore(release): 2.0.2 #76

chore(release): 2.0.2

chore(release): 2.0.2 #76

name: Build and Release
on:
push:
branches:
- main
jobs:
release:
runs-on: windows-latest
env:
GH_TOKEN: ${{ secrets.GH_TOKEN }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 2
- name: Check if package.json changed
id: check_version
run: |
if git diff --name-only HEAD~1 HEAD | findstr "package.json"; then
echo "VERSION_CHANGED=true" >> $GITHUB_ENV
else
echo "VERSION_CHANGED=false" >> $GITHUB_ENV
fi
shell: bash
continue-on-error: true
- name: Setup Node.js
if: env.VERSION_CHANGED == 'true'
uses: actions/setup-node@v4
with:
node-version: 20
- name: Install dependencies
if: env.VERSION_CHANGED == 'true'
run: npm install
- name: Build Electron App
if: env.VERSION_CHANGED == 'true'
run: npm run build
- name: Check if gh is already installed
id: check_gh
run: |
if gh --version; then
echo "GH_INSTALLED=true" >> $GITHUB_ENV
else
echo "GH_INSTALLED=false" >> $GITHUB_ENV
fi
shell: bash
- name: Install GitHub CLI
if: env.GH_INSTALLED == 'false'
run: choco install gh --install-arguments="'/l*v c:\gh_msi_install.log'"
- name: Create GitHub Release and Upload Artifacts
if: env.VERSION_CHANGED == 'true'
run: |
$newVersion = $(node -p "require('./package.json').version")
$changelogContent = Get-Content -Raw -Path ./changelog.md
$releaseFiles = Get-ChildItem -Path .\dist\ -Include *.exe,latest.yml -Recurse | Where-Object { $_.Name -ne 'elevate.exe' }
$filePathsArray = @()
foreach ($file in $releaseFiles) {
$filePathsArray += $file.FullName
}
$ghArgs = @('release', 'create', "v$newVersion", '--title', "v$newVersion", '--notes', "$changelogContent")
$ghArgs += $filePathsArray
gh @ghArgs
shell: pwsh