modified: .github/workflows/ci-cd.yml #49
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: CI/CD | |
on: | |
push: | |
branches: [ main ] | |
pull_request: | |
branches: [ main ] | |
permissions: | |
contents: write | |
env: | |
NODE_VERSION: '20' | |
jobs: | |
build-windows: | |
runs-on: windows-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: ${{ env.NODE_VERSION }} | |
- name: Install dependencies | |
run: | | |
npm install -g npm@latest | |
cd frontend | |
npm ci | |
shell: bash | |
- name: Build Electron app | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
cd frontend | |
echo "Node version: $(node -v)" | |
echo "NPM version: $(npm -v)" | |
echo "Current directory: $(Get-Location)" | |
echo "Directory contents:" | |
Get-ChildItem -Recurse | |
echo "Package.json contents:" | |
Get-Content package.json | |
echo "Running npm run dist:windows" | |
npm run dist:windows | |
if ($LASTEXITCODE -ne 0) { | |
echo "Build failed with error code $LASTEXITCODE" | |
Get-ChildItem -Recurse dist | |
exit 1 | |
} | |
shell: powershell | |
- name: Upload artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: dist-windows | |
path: frontend/dist | |
release: | |
needs: build-windows | |
runs-on: ubuntu-latest | |
if: github.event_name == 'push' && github.ref == 'refs/heads/main' | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Download artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
name: dist-windows | |
path: artifacts | |
- name: Create Release | |
id: create_release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: v${{ github.run_number }} | |
release_name: Release v${{ github.run_number }} | |
draft: false | |
prerelease: false | |
- name: Upload Release Assets | |
uses: softprops/action-gh-release@v1 | |
with: | |
tag_name: v${{ github.run_number }} | |
files: | | |
./artifacts/*.exe | |
./artifacts/*.msi | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |