bump version #70
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build and Release | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
release: | |
runs-on: windows-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
with: | |
fetch-depth: 2 | |
- name: Check if package.json changed | |
id: check_version | |
run: | | |
git diff --name-only HEAD~1 HEAD | grep 'package.json' | |
if [ $? -eq 0 ]; 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@v2 | |
with: | |
node-version: 18 | |
- 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 | |
env: | |
GH_TOKEN: ${{ secrets.GH_TOKEN }} | |