mirror of
https://github.com/ragestudio/comty.git
synced 2025-06-09 10:34:17 +00:00
update for build
This commit is contained in:
parent
6c6cb2b609
commit
89a5b30a90
59
changelogs/v1-25-0@alpha.md
Normal file
59
changelogs/v1-25-0@alpha.md
Normal file
@ -0,0 +1,59 @@
|
||||
* [+16/-16][utils] [fix argus](https://github.com/ragestudio/comty/commit/6c6cb2b609303a8bdb685639479ee4ea4e8416bf) - by [@SrGooglo](https://github.com/srgooglo)
|
||||
|
||||
* [+1/-1][app] [update ignore](https://github.com/ragestudio/comty/commit/bd79c2d7cf6a15c6532b7b1693c3399bf9d3212f) - by [@SrGooglo](https://github.com/srgooglo)
|
||||
|
||||
* [+1/-1][internal] [update external](https://github.com/ragestudio/comty/commit/f8eb297ab310a5a1439c94b17f1a8304cd425ec2) - by [@SrGooglo](https://github.com/srgooglo)
|
||||
|
||||
* [+3/-1][app] [update gitignore](https://github.com/ragestudio/comty/commit/e5365ae2e2eebd0867cfe207f04fd538cd0b6471) - by [@SrGooglo](https://github.com/srgooglo)
|
||||
|
||||
* [+44/-43][server] [return items](https://github.com/ragestudio/comty/commit/f70c9ff53ee07c7e31f3009fafbac2b6bd87332b) - by [@SrGooglo](https://github.com/srgooglo)
|
||||
|
||||
* [+420/-404][app] [use swappy](https://github.com/ragestudio/comty/commit/bca40318bdade6161675355dde4bb602d77c45a3) - by [@SrGooglo](https://github.com/srgooglo)
|
||||
|
||||
* [+32/-61][app] [replace plyr](https://github.com/ragestudio/comty/commit/7ae3c19e7dce0abf5d9dbd6b55b94da7c7d5dfd1) - by [@SrGooglo](https://github.com/srgooglo)
|
||||
|
||||
* [+8/-0][app] [tweak muxer](https://github.com/ragestudio/comty/commit/afa989b62758c8d6344e797a9ee6c0701c4a3a91) - by [@SrGooglo](https://github.com/srgooglo)
|
||||
|
||||
* [+7/-7][app] [remove temporaly mediasession](https://github.com/ragestudio/comty/commit/e4a6bfd4472c2d28e7e6fe2b9a37a61b7e0b609c) - by [@SrGooglo](https://github.com/srgooglo)
|
||||
|
||||
* [+208/-115][app] [update _debugs](https://github.com/ragestudio/comty/commit/14234ffa6ca0a59f7c15d36dfc8af999a93bd256) - by [@SrGooglo](https://github.com/srgooglo)
|
||||
|
||||
* [+0/-0][app] [rename](https://github.com/ragestudio/comty/commit/10759e0cef2b625085b2aa074bba45cdc3ad18be) - by [@SrGooglo](https://github.com/srgooglo)
|
||||
|
||||
* [+95/-86][app] [improve explore tab](https://github.com/ragestudio/comty/commit/d21ca837dc6197cef3dd75a04df99407de0d4f24) - by [@SrGooglo](https://github.com/srgooglo)
|
||||
|
||||
* [+37/-41][app] [formaat](https://github.com/ragestudio/comty/commit/8b98a60f82dd612eaf74778e2d58b1a2777fe468) - by [@SrGooglo](https://github.com/srgooglo)
|
||||
|
||||
* [+63/-128][app] [improve setting load](https://github.com/ragestudio/comty/commit/a70871293581ec3021b15bf311de407d0137032e) - by [@SrGooglo](https://github.com/srgooglo)
|
||||
|
||||
* [+12/-282][app] [remove splash styles](https://github.com/ragestudio/comty/commit/41e34f35c01a08a829047d3e2ae104aed77bfe3e) - by [@SrGooglo](https://github.com/srgooglo)
|
||||
|
||||
* [+2926/-2856][app] [fix depecrated deps](https://github.com/ragestudio/comty/commit/3cf055c72c7799ae9835a850fed914264af0afc8) - by [@SrGooglo](https://github.com/srgooglo)
|
||||
|
||||
* [+49/-26][app] [fix log](https://github.com/ragestudio/comty/commit/79f64eaec289f89ee65cb1bb628bf4cef159862f) - by [@SrGooglo](https://github.com/srgooglo)
|
||||
|
||||
* [+49/-171][app] [update licenses](https://github.com/ragestudio/comty/commit/c9b485991e39fad9d19fd89d7ff0703dbdfa39a7) - by [@SrGooglo](https://github.com/srgooglo)
|
||||
|
||||
* [+112/-110][server] [fix 500 when no metadata provided](https://github.com/ragestudio/comty/commit/78d0ec0e30aed4636eb7b90678cb4cda246204bd) - by [@SrGooglo](https://github.com/srgooglo)
|
||||
|
||||
* [+200/-20][app] [add splash screen](https://github.com/ragestudio/comty/commit/aa5209d225a3317ae81e4979e1cf3c39e0b3acfd) - by [@SrGooglo](https://github.com/srgooglo)
|
||||
|
||||
* [+1/-36][app] [remove unused utils](https://github.com/ragestudio/comty/commit/79b1f620a3f7dbe47596a2c0e787b80186c802de) - by [@SrGooglo](https://github.com/srgooglo)
|
||||
|
||||
* [+169/-166][app] [improve track cover image render](https://github.com/ragestudio/comty/commit/06dcf0b96170c509342d3a5e3be6c1da6bc62705) - by [@SrGooglo](https://github.com/srgooglo)
|
||||
|
||||
* [+325/-537][wrapper | package.json | src] [rewrite wrapper](https://github.com/ragestudio/comty/commit/54c7c3c59d92dec44c41dc09e53d07a52e9079b8) - by [@SrGooglo](https://github.com/srgooglo)
|
||||
|
||||
* [+3/-3][app | server] [update version](https://github.com/ragestudio/comty/commit/028f14f12b05471f2e0f8e6b03c865f71005d6f7) - by [@SrGooglo](https://github.com/srgooglo)
|
||||
|
||||
* [+16/-1][app] [support for parse times](https://github.com/ragestudio/comty/commit/342cc34d65ea316e7fd00a88fb71e47456768abc) - by [@SrGooglo](https://github.com/srgooglo)
|
||||
|
||||
* [+206/-190][app] [improve overrides](https://github.com/ragestudio/comty/commit/dde659ef010f4b17e6b079d6c169a757ad0c4e63) - by [@SrGooglo](https://github.com/srgooglo)
|
||||
|
||||
* [+1/-0][server] [added deps](https://github.com/ragestudio/comty/commit/3b04ef604404811e89557177c93a91975e0748c3) - by [@SrGooglo](https://github.com/srgooglo)
|
||||
|
||||
* [+17/-0][server] [added `trackOverride` db model](https://github.com/ragestudio/comty/commit/c63e9288f2aeddca30f6e24304025e4c87fa0019) - by [@SrGooglo](https://github.com/srgooglo)
|
||||
|
||||
* [+85/-0][server] [added basic search endpoint](https://github.com/ragestudio/comty/commit/e9a6fa9c7ef09148df18fa2f017508b689329495) - by [@SrGooglo](https://github.com/srgooglo)
|
||||
|
||||
* [+305/-187][server] [use new items list standart](https://github.com/ragestudio/comty/commit/9c9fa4c18b6e026c4d2f871be31171235e917843) - by [@SrGooglo](https://github.com/srgooglo)
|
@ -1,38 +1,38 @@
|
||||
services:
|
||||
app:
|
||||
build: packages/app
|
||||
restart: unless-stopped
|
||||
networks:
|
||||
- internal_network
|
||||
ports:
|
||||
- "3000:3000"
|
||||
env_file:
|
||||
- ./.env
|
||||
api:
|
||||
build: packages/server
|
||||
restart: unless-stopped
|
||||
networks:
|
||||
- internal_network
|
||||
ports:
|
||||
- "9000:9000"
|
||||
env_file:
|
||||
- ./.env
|
||||
wrapper:
|
||||
build: packages/wrapper
|
||||
restart: unless-stopped
|
||||
networks:
|
||||
- internal_network
|
||||
ports:
|
||||
- "3000:3000"
|
||||
env_file:
|
||||
- ./.env
|
||||
api:
|
||||
build: packages/server
|
||||
restart: unless-stopped
|
||||
networks:
|
||||
- internal_network
|
||||
ports:
|
||||
- "9000:9000"
|
||||
env_file:
|
||||
- ./.env
|
||||
|
||||
redis:
|
||||
image: docker.dragonflydb.io/dragonflydb/dragonfly:latest
|
||||
restart: unless-stopped
|
||||
ulimits:
|
||||
memlock: -1
|
||||
command:
|
||||
- "--requirepass=changeme2424"
|
||||
networks:
|
||||
- internal_network
|
||||
env_file:
|
||||
- ./.env
|
||||
ports:
|
||||
- "6379:6379"
|
||||
volumes:
|
||||
- ./redis_data:/data
|
||||
redis:
|
||||
image: docker.dragonflydb.io/dragonflydb/dragonfly:latest
|
||||
restart: unless-stopped
|
||||
ulimits:
|
||||
memlock: -1
|
||||
command:
|
||||
- "--requirepass=changeme2424"
|
||||
networks:
|
||||
- internal_network
|
||||
env_file:
|
||||
- ./.env
|
||||
ports:
|
||||
- "6379:6379"
|
||||
volumes:
|
||||
- ./redis_data:/data
|
||||
|
||||
networks:
|
||||
internal_network:
|
||||
internal_network:
|
||||
|
47
package.json
47
package.json
@ -1,25 +1,26 @@
|
||||
{
|
||||
"author": "RageStudio",
|
||||
"license": "ComtyLicense",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"dev": "concurrently -k \"yarn dev:client\" \"yarn dev:server\"",
|
||||
"dev:server": "cd packages/server && yarn dev",
|
||||
"dev:client": "cd packages/app && yarn dev",
|
||||
"release": "node ./scripts/release.js",
|
||||
"postdeploy": "node ./scripts/post-deploy.js",
|
||||
"postinstall": "node ./scripts/post-install.js"
|
||||
},
|
||||
"dependencies": {
|
||||
"7zip-min": "1.4.3",
|
||||
"@ragestudio/hermes": "^1.0.0",
|
||||
"axios": "^1.4.0",
|
||||
"concurrently": "^7.5.0",
|
||||
"dotenv": "16.0.3",
|
||||
"form-data": "^4.0.0",
|
||||
"mintlify": "^4.0.206",
|
||||
"octokit": "^2.0.14",
|
||||
"pm2": "5.3.0"
|
||||
},
|
||||
"_web_app_path": "packages/app"
|
||||
"version": "1.25.0@alpha",
|
||||
"author": "RageStudio",
|
||||
"license": "ComtyLicense",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"dev": "concurrently -k \"yarn dev:client\" \"yarn dev:server\"",
|
||||
"dev:server": "cd packages/server && yarn dev",
|
||||
"dev:client": "cd packages/app && yarn dev",
|
||||
"release": "node ./scripts/release.js",
|
||||
"postdeploy": "node ./scripts/post-deploy.js",
|
||||
"postinstall": "node ./scripts/post-install.js"
|
||||
},
|
||||
"dependencies": {
|
||||
"7zip-min": "1.4.3",
|
||||
"@ragestudio/hermes": "^1.0.0",
|
||||
"axios": "^1.4.0",
|
||||
"concurrently": "^7.5.0",
|
||||
"dotenv": "16.0.3",
|
||||
"form-data": "^4.0.0",
|
||||
"mintlify": "^4.0.206",
|
||||
"octokit": "^2.0.14",
|
||||
"pm2": "5.3.0"
|
||||
},
|
||||
"_web_app_path": "packages/app"
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@comty/app",
|
||||
"version": "1.25.0-a",
|
||||
"version": "1.25.0@alpha",
|
||||
"license": "ComtyLicense",
|
||||
"main": "electron/main",
|
||||
"type": "module",
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@comty/server",
|
||||
"version": "1.25.0-a",
|
||||
"version": "1.25.0@alpha",
|
||||
"license": "ComtyLicense",
|
||||
"private": true,
|
||||
"workspaces": [
|
||||
|
@ -1,103 +0,0 @@
|
||||
import path from "node:path"
|
||||
import fs from "node:fs"
|
||||
import HyperExpress from "hyper-express"
|
||||
import LiveDirectory from "live-directory"
|
||||
|
||||
const { WebSocket: WSClient } = require("ws")
|
||||
const http = require("http")
|
||||
|
||||
// CONFIGURATION CONSTANTS
|
||||
const publicPath = path.resolve(process.cwd(), "public")
|
||||
const TARGET_HTTP = "http://localhost:9000"
|
||||
const TARGET_WS = "ws://localhost:8080"
|
||||
const LISTENT_PORT = 9999
|
||||
|
||||
async function main() {
|
||||
if (!fs.existsSync(publicPath)) {
|
||||
console.log("Public path does not exist, creating...")
|
||||
fs.mkdirSync(publicPath)
|
||||
}
|
||||
|
||||
const app = new HyperExpress.Server()
|
||||
const liveDirectory = new LiveDirectory(publicPath)
|
||||
|
||||
app.any("/*", async (req, res) => {
|
||||
if (req.url.startsWith("/api")) {
|
||||
return handleApiProxyRequest(req, res)
|
||||
}
|
||||
|
||||
return handleStaticFileRequest(liveDirectory, req, res)
|
||||
})
|
||||
|
||||
await app.listen(LISTENT_PORT)
|
||||
|
||||
console.log(`LISTENING on port ${LISTENT_PORT}`)
|
||||
}
|
||||
|
||||
async function handleStaticFileRequest(liveDirectory, req, res) {
|
||||
let file = liveDirectory.get(req.path)
|
||||
|
||||
if (file === undefined) {
|
||||
file = liveDirectory.get("index.html")
|
||||
}
|
||||
|
||||
if (file === undefined) {
|
||||
return res.status(404).json({ error: "Not found" })
|
||||
}
|
||||
|
||||
const fileParts = file.path.split(".")
|
||||
const extension = fileParts[fileParts.length - 1]
|
||||
|
||||
// Retrieve the file content and serve it depending on the type of content available for this file
|
||||
const content = file.content
|
||||
|
||||
if (content instanceof Buffer) {
|
||||
// Set appropriate mime-type and serve file content Buffer as response body (This means that the file content was cached in memory)
|
||||
return res.type(extension).send(content)
|
||||
} else {
|
||||
// Set the type and stream the content as the response body (This means that the file content was NOT cached in memory)
|
||||
return res.type(extension).stream(content)
|
||||
}
|
||||
}
|
||||
|
||||
async function handleApiProxyRequest(request, response) {
|
||||
try {
|
||||
const targetURL = new URL(request.url, TARGET_HTTP)
|
||||
const headers = { ...request.headers, host: targetURL.host }
|
||||
|
||||
// Configurar la solicitud al servidor de destino
|
||||
const proxyReq = http.request({
|
||||
hostname: targetURL.hostname,
|
||||
port: targetURL.port || 80,
|
||||
path: targetURL.pathname + targetURL.search,
|
||||
method: request.method,
|
||||
headers,
|
||||
})
|
||||
|
||||
// Manejar la respuesta del servidor de destino
|
||||
proxyReq.on("response", (proxyRes) => {
|
||||
response.status(proxyRes.statusCode)
|
||||
|
||||
// Copiar headers
|
||||
Object.entries(proxyRes.headers).forEach(([key, val]) => {
|
||||
response.header(key, val)
|
||||
})
|
||||
|
||||
// Pipe de la respuesta
|
||||
proxyRes.pipe(response.stream)
|
||||
})
|
||||
|
||||
// Manejar errores
|
||||
proxyReq.on("error", (error) => {
|
||||
response.status(500).send(`Proxy error: ${error.message}`)
|
||||
})
|
||||
|
||||
// Pipe del cuerpo de la solicitud
|
||||
request.stream().pipe(proxyReq)
|
||||
} catch (error) {
|
||||
console.error(error)
|
||||
response.status(500).send("Internal Server Error")
|
||||
}
|
||||
}
|
||||
|
||||
main()
|
@ -23,174 +23,187 @@ const changelogsPath = path.resolve(process.cwd(), "changelogs")
|
||||
const packedDistPath = path.resolve(appDistPath, "dist.zip")
|
||||
|
||||
async function main() {
|
||||
if (!process.env.GITHUB_TOKEN) {
|
||||
console.error("🆘 Missing GITHUB_TOKEN env")
|
||||
return false
|
||||
}
|
||||
if (!process.env.GITHUB_TOKEN) {
|
||||
console.error("🆘 Missing GITHUB_TOKEN env")
|
||||
return false
|
||||
}
|
||||
|
||||
const octokit = new Octokit({
|
||||
auth: process.env.GITHUB_TOKEN
|
||||
})
|
||||
const octokit = new Octokit({
|
||||
auth: process.env.GITHUB_TOKEN,
|
||||
})
|
||||
|
||||
let steps = {
|
||||
build: true,
|
||||
bundle: true,
|
||||
publish: true,
|
||||
ignoreCommits: false,
|
||||
ignoreVersion: false,
|
||||
changelog: true,
|
||||
}
|
||||
let steps = {
|
||||
build: true,
|
||||
bundle: true,
|
||||
publish: true,
|
||||
ignoreCommits: false,
|
||||
ignoreVersion: false,
|
||||
changelog: true,
|
||||
}
|
||||
|
||||
if (process.argv.includes("--no-pack")) {
|
||||
steps.bundle = false
|
||||
}
|
||||
let changelogData = null
|
||||
|
||||
if (process.argv.includes("--no-publish")) {
|
||||
steps.publish = false
|
||||
}
|
||||
if (process.argv.includes("--no-pack")) {
|
||||
steps.bundle = false
|
||||
}
|
||||
|
||||
if (process.argv.includes("--no-build")) {
|
||||
steps.build = false
|
||||
}
|
||||
if (process.argv.includes("--no-publish")) {
|
||||
steps.publish = false
|
||||
}
|
||||
|
||||
if (process.argv.includes("--ignore-commits")) {
|
||||
steps.ignoreCommits = true
|
||||
}
|
||||
if (process.argv.includes("--no-build")) {
|
||||
steps.build = false
|
||||
}
|
||||
|
||||
if (process.argv.includes("--ignore-version")) {
|
||||
steps.ignoreVersion = true
|
||||
}
|
||||
if (process.argv.includes("--ignore-commits")) {
|
||||
steps.ignoreCommits = true
|
||||
}
|
||||
|
||||
// check if is any changes pending to commit
|
||||
if (!steps.ignoreCommits) {
|
||||
const gitStatus = child_process.execSync("git status --porcelain", {
|
||||
cwd: process.cwd()
|
||||
}).toString().trim()
|
||||
if (process.argv.includes("--ignore-version")) {
|
||||
steps.ignoreVersion = true
|
||||
}
|
||||
|
||||
if (gitStatus.length > 0) {
|
||||
console.warn("There are pending changes to commit, please commit first.")
|
||||
return false
|
||||
}
|
||||
}
|
||||
// check if is any changes pending to commit
|
||||
if (!steps.ignoreCommits) {
|
||||
const gitStatus = child_process
|
||||
.execSync("git status --porcelain", {
|
||||
cwd: process.cwd(),
|
||||
})
|
||||
.toString()
|
||||
.trim()
|
||||
|
||||
let currentVersion = packagejson.version
|
||||
if (gitStatus.length > 0) {
|
||||
console.warn(
|
||||
"There are pending changes to commit, please commit first.",
|
||||
)
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
// check if currentVersion match with current latest release on github
|
||||
const latestRelease = await octokit.repos.getLatestRelease({
|
||||
owner: repo.split("/")[0],
|
||||
repo: repo.split("/")[1]
|
||||
}).catch((err) => {
|
||||
console.error(`🆘 Failed to get latest release: ${err}`)
|
||||
return false
|
||||
})
|
||||
let currentVersion = packagejson.version
|
||||
|
||||
if (!latestRelease) {
|
||||
console.error("🆘 Failed to get latest release")
|
||||
return false
|
||||
}
|
||||
// check if currentVersion match with current latest release on github
|
||||
const latestRelease = await octokit.repos
|
||||
.getLatestRelease({
|
||||
owner: repo.split("/")[0],
|
||||
repo: repo.split("/")[1],
|
||||
})
|
||||
.catch((err) => {
|
||||
console.error(`🆘 Failed to get latest release: ${err}`)
|
||||
return false
|
||||
})
|
||||
|
||||
if (!steps.ignoreVersion) {
|
||||
if (latestRelease && latestRelease.data.tag_name === currentVersion) {
|
||||
if (process.argv.includes("--bump")) {
|
||||
const bumpType = process.argv[process.argv.indexOf("--bump") + 1]
|
||||
if (!latestRelease) {
|
||||
console.error("🆘 Failed to get latest release")
|
||||
return false
|
||||
}
|
||||
|
||||
const newVersion = await bumpVersion({
|
||||
root: process.cwd(),
|
||||
type: bumpType,
|
||||
count: 1
|
||||
}).catch((error) => {
|
||||
console.error(`🆘 Failed to bump version >`, error)
|
||||
return false
|
||||
})
|
||||
if (!steps.ignoreVersion) {
|
||||
if (latestRelease && latestRelease.data.tag_name === currentVersion) {
|
||||
if (process.argv.includes("--bump")) {
|
||||
const bumpType =
|
||||
process.argv[process.argv.indexOf("--bump") + 1]
|
||||
|
||||
if (!newVersion) {
|
||||
throw new Error("Failed to bump version")
|
||||
}
|
||||
const newVersion = await bumpVersion({
|
||||
root: process.cwd(),
|
||||
type: bumpType,
|
||||
count: 1,
|
||||
}).catch((error) => {
|
||||
console.error(`🆘 Failed to bump version >`, error)
|
||||
return false
|
||||
})
|
||||
|
||||
currentVersion = newVersion
|
||||
if (!newVersion) {
|
||||
throw new Error("Failed to bump version")
|
||||
}
|
||||
|
||||
// create new commit
|
||||
await child_process.execSync(`git add . && git commit -m "Bump version to ${currentVersion}"`, {
|
||||
cwd: process.cwd(),
|
||||
stdio: "inherit"
|
||||
})
|
||||
currentVersion = newVersion
|
||||
|
||||
// push to remote
|
||||
await child_process.execSync(`git push`, {
|
||||
cwd: process.cwd(),
|
||||
stdio: "inherit"
|
||||
})
|
||||
} else {
|
||||
console.log("🚫 Current version is already latest version, please bump version first. \n - use --bump <patch|minor|major> to automatically bump version. \n - use --ignore-version to force release.")
|
||||
return true
|
||||
}
|
||||
}
|
||||
}
|
||||
// create new commit
|
||||
await child_process.execSync(
|
||||
`git add . && git commit -m "Bump version to ${currentVersion}"`,
|
||||
{
|
||||
cwd: process.cwd(),
|
||||
stdio: "inherit",
|
||||
},
|
||||
)
|
||||
|
||||
if (steps.build) {
|
||||
steps.build = await buildAppDist(appSrcPath)
|
||||
}
|
||||
// push to remote
|
||||
await child_process.execSync(`git push`, {
|
||||
cwd: process.cwd(),
|
||||
stdio: "inherit",
|
||||
})
|
||||
} else {
|
||||
console.log(
|
||||
"🚫 Current version is already latest version, please bump version first. \n - use --bump <patch|minor|major> to automatically bump version. \n - use --ignore-version to force release.",
|
||||
)
|
||||
return true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (steps.bundle) {
|
||||
steps.bundle = await compressDistBundle(appDistPath, packedDistPath)
|
||||
}
|
||||
if (steps.build) {
|
||||
steps.build = await buildAppDist(appSrcPath)
|
||||
}
|
||||
|
||||
if (steps.changelog) {
|
||||
const changelog = await composeChangelog()
|
||||
if (steps.bundle) {
|
||||
steps.bundle = await compressDistBundle(appDistPath, packedDistPath)
|
||||
}
|
||||
|
||||
steps.changelog = path.resolve(changelogsPath, `v${currentVersion.split(".").join("-")}.md`)
|
||||
if (steps.changelog) {
|
||||
changelogData = await composeChangelog()
|
||||
|
||||
console.log(`📝 Writing changelog to file > ${steps.changelog}`)
|
||||
steps.changelog = path.resolve(
|
||||
changelogsPath,
|
||||
`v${currentVersion.split(".").join("-")}.md`,
|
||||
)
|
||||
|
||||
// write changelog to file
|
||||
fs.writeFileSync(steps.changelog, changelog)
|
||||
}
|
||||
console.log(`📝 Writing changelog to file > ${steps.changelog}`)
|
||||
|
||||
if (steps.publish) {
|
||||
const release = await createGithubRelease(
|
||||
repo,
|
||||
{
|
||||
version: currentVersion,
|
||||
changelog,
|
||||
},
|
||||
process.env.GITHUB_TOKEN,
|
||||
).catch((err) => {
|
||||
console.error(`🆘 Failed to create release: ${err}`)
|
||||
return false
|
||||
})
|
||||
// write changelog to file
|
||||
fs.writeFileSync(steps.changelog, changelogData)
|
||||
}
|
||||
|
||||
console.log("🎉 Release done!")
|
||||
if (steps.publish) {
|
||||
const release = await createGithubRelease(
|
||||
repo,
|
||||
{
|
||||
version: currentVersion,
|
||||
changelog: changelogData,
|
||||
},
|
||||
process.env.GITHUB_TOKEN,
|
||||
).catch((err) => {
|
||||
console.error(`🆘 Failed to create release: ${err}`)
|
||||
return false
|
||||
})
|
||||
|
||||
if (!release) {
|
||||
return false
|
||||
}
|
||||
console.log("🎉 Release done!")
|
||||
|
||||
const assets = await uploadAssets(
|
||||
octokit,
|
||||
repo,
|
||||
release,
|
||||
[
|
||||
{
|
||||
name: packedDistPath,
|
||||
data: fs.readFileSync(packedDistPath)
|
||||
},
|
||||
{
|
||||
name: "changelog.md",
|
||||
data: fs.readFileSync(steps.changelog)
|
||||
}
|
||||
],
|
||||
)
|
||||
if (!release) {
|
||||
return false
|
||||
}
|
||||
|
||||
console.log("🎉 Assets uploaded! >", assets)
|
||||
const assets = await uploadAssets(octokit, repo, release, [
|
||||
{
|
||||
name: packedDistPath,
|
||||
data: fs.readFileSync(packedDistPath),
|
||||
},
|
||||
{
|
||||
name: "changelog.md",
|
||||
data: fs.readFileSync(steps.changelog),
|
||||
},
|
||||
])
|
||||
|
||||
console.log(`🔗 ${release.html_url}`)
|
||||
}
|
||||
console.log("🎉 Assets uploaded! >", assets)
|
||||
|
||||
console.log("All Done!")
|
||||
console.log(`🔗 ${release.html_url}`)
|
||||
}
|
||||
|
||||
return true
|
||||
console.log("All Done!")
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
main().catch((err) => {
|
||||
console.error(`Fatal error: `, err)
|
||||
})
|
||||
console.error(`Fatal error: `, err)
|
||||
})
|
||||
|
Loading…
x
Reference in New Issue
Block a user