Skip to content

Commit cfe97f2

Browse files
authored
release: release & add generate release data and openapi generation(backend/front) scripts
1 parent f9ea445 commit cfe97f2

14 files changed

+111
-13
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,7 @@ Electron/.erb/dll/**
158158
# release
159159
Electron/release/build/**
160160
Electron/release/app/dist/**
161+
release_temp/
161162

162163

163164
#python

Electron/package-lock.json

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Electron/package.json

-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
"format:check": "prettier src/ --check --ignore-path .prettierignore",
2222
"package": "ts-node ./.erb/scripts/clean.js dist && npm run build && electron-builder build --publish never",
2323
"package:win": "ts-node ./.erb/scripts/clean.js dist && npm run build && electron-builder build --publish never --win",
24-
"package:linux:deb": "ts-node ./.erb/scripts/clean.js dist && npm run build && electron-builder build --publish never --linux deb",
2524
"package:linux:appimage": "ts-node ./.erb/scripts/clean.js dist && npm run build && electron-builder build --publish never --linux appimage",
2625
"rebuild": "electron-rebuild --parallel --types prod,dev,optional --module-dir release/app",
2726
"start": "ts-node ./.erb/scripts/check-port-in-use.js && npm run start:renderer",

Electron/release/app/package-lock.json

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Electron/release/app/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "spotify-electron",
3-
"version": "2.0.0",
3+
"version": "2.0.1",
44
"description": "Spotify Electron is a cross-platform music streaming desktop app made with Electron-React frontend and Python-FastAPI-AWS Backend. The goal is to reproduce the original Spotify functionality while adding new ones like uploading songs",
55
"author": {
66
"name": "Antonio Martinez Fernandez",

Electron/src/swagger/api/core/OpenAPI.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ export type OpenAPIConfig = {
2121

2222
export const OpenAPI: OpenAPIConfig = {
2323
BASE: '',
24-
VERSION: '2.0.0',
24+
VERSION: '2.0.1',
2525
WITH_CREDENTIALS: false,
2626
CREDENTIALS: 'include',
2727
TOKEN: undefined,

docs/developer/frontend/Package-app.md

-6
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,3 @@ An `.exe` will be generated
5151
```console
5252
npm run package:win
5353
```
54-
55-
##### Deb (not working)
56-
57-
```console
58-
npm run package:linux:deb
59-
```

docs/developer/utils/OpenAPI.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,5 @@ OpenAPI is a standard for describing and documenting APIs. It uses schemas to de
1515
## Generate OpenAPI Client (Frontend)
1616

1717
1. Go to `Electron/`
18-
2. Install app dependencies with `npm run build && npm install`
18+
2. Install app dependencies with `npm install && npm run build`
1919
3. Run `npm run generate-openapi-client` for generating code for backend requests based on its endpoints.

tools/generate_release_data.sh

+64
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
#!/bin/bash
2+
3+
# Exit on error for most commands but allow non-critical errors to be skipped
4+
set -e
5+
set -o pipefail # Capture errors from pipes
6+
7+
# =============================
8+
# Create release_temp directory
9+
# =============================
10+
cd ../
11+
mkdir -p release_temp/
12+
13+
# =============================
14+
# Copy release assets
15+
# =============================
16+
echo "Copying release assets..."
17+
18+
cp docs/assets/logo.png release_temp/logo.png
19+
echo "Copied logo.png"
20+
21+
cp docs/assets/logo.png release_temp/spotify-electron.desktop
22+
echo "Copied spotify-electron.desktop"
23+
24+
# =============================
25+
# Backend OPENAPI generation and Frontend OPENAPI client update
26+
# =============================
27+
echo "Starting Backend OPENAPI generation and Frontend OpenAPI client update..."
28+
29+
cd tools/
30+
./update_openapi.sh
31+
32+
echo "Virtual environment deactivated"
33+
34+
# =============================
35+
# FRONTEND app client
36+
# =============================
37+
echo "Starting Frontend app client update..."
38+
39+
# Navigate to the Electron directory
40+
cd ../Electron/
41+
42+
# Install dependencies, build, and generate OpenAPI client
43+
npm install
44+
echo "npm install completed"
45+
46+
npm run build
47+
echo "Frontend build completed"
48+
49+
# =============================
50+
# Package the app for Linux and Windows
51+
# =============================
52+
npm run package:linux:appimage
53+
mv release/build/SpotifyElectron.AppImage ../release_temp/
54+
echo "Linux AppImage packaged and moved"
55+
56+
npm run package:win
57+
mv release/build/SpotifyElectron.exe ../release_temp/
58+
echo "Windows executable packaged and moved"
59+
60+
# =============================
61+
# Finish
62+
# =============================
63+
echo "Release process completed successfully."
64+
exit 0

tools/update_openapi.sh

+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
#!/bin/bash
2+
cd ../
3+
4+
5+
cd Backend/
6+
7+
# Activate the virtual environment
8+
source venv/bin/activate
9+
echo "Virtual environment activated"
10+
11+
# Check if mongomock is installed
12+
if pip show mongomock > /dev/null 2>&1; then
13+
echo "mongomock is installed"
14+
else
15+
echo "mongomock is not installed"
16+
exit 1
17+
fi
18+
19+
# Set the environment variable and execute the Python command
20+
echo "Generating OpenAPI schema with timeout..."
21+
timeout 15s env ENV_VALUE="TEST" python -m app.tools.generate_openapi || {
22+
echo "Error: Python generate_openapi script timed out";
23+
exit 1
24+
}
25+
26+
echo "OpenAPI schema generation completed"
27+
28+
# Deactivate the virtual environment
29+
deactivate
30+
echo "Virtual environment deactivated"
31+
32+
# Navigate to the Electron directory and run OpenAPI client generation
33+
cd ../Electron/
34+
35+
npm install
36+
npm build
37+
# Generate the OpenAPI client
38+
echo "Generating OpenAPI client..."
39+
npm run generate-openapi-client || { echo "Error: OpenAPI client generation failed"; exit 1; }
40+
echo "OpenAPI client generation completed"

0 commit comments

Comments
 (0)