mirror of
https://github.com/Vendicated/Vencord.git
synced 2025-02-24 15:35:11 +00:00
maybe more releases
This commit is contained in:
parent
5160f906f4
commit
3edbed12ad
5 changed files with 46 additions and 14 deletions
36
.github/workflows/build.yml
vendored
36
.github/workflows/build.yml
vendored
|
@ -1,8 +1,6 @@
|
||||||
name: Build DevBuild
|
name: Build releases
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches:
|
|
||||||
- main
|
|
||||||
paths:
|
paths:
|
||||||
- .github/workflows/build.yml
|
- .github/workflows/build.yml
|
||||||
- src/**
|
- src/**
|
||||||
|
@ -45,21 +43,39 @@ jobs:
|
||||||
rm -rf dist/*-unpacked dist/monaco Vencord.user.css vencordDesktopRenderer.css vencordDesktopRenderer.css.map
|
rm -rf dist/*-unpacked dist/monaco Vencord.user.css vencordDesktopRenderer.css vencordDesktopRenderer.css.map
|
||||||
|
|
||||||
- name: Get some values needed for the release
|
- name: Get some values needed for the release
|
||||||
id: release_values
|
|
||||||
run: |
|
run: |
|
||||||
echo "release_tag=$(git rev-parse --short HEAD)" >> $GITHUB_ENV
|
echo "commit_short=$(git rev-parse --short HEAD)" >> $GITHUB_ENV
|
||||||
|
gh release view devbuild &> /dev/null \
|
||||||
|
&& echo "devbuild_exists=true" >> $GITHUB_ENV \
|
||||||
|
|| echo "devbuild_exists=false" >> $GITHUB_ENV
|
||||||
|
|
||||||
- name: Upload DevBuild as release
|
- name: Upload latest release (devbuild)
|
||||||
if: github.repository == 'Vendicated/Vencord'
|
if: env.devbuild_exists == 'true' && startsWith(github.ref, 'refs/heads/') && github.ref_name == 'main' && github.event.created
|
||||||
run: |
|
run: |
|
||||||
gh release upload devbuild --clobber dist/*
|
gh release upload devbuild --clobber dist/*
|
||||||
gh release edit devbuild --title "DevBuild $RELEASE_TAG"
|
gh release edit devbuild --title "DevBuild $COMMIT_SHORT"
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
|
- name: Upload branch release
|
||||||
|
if: env.devbuild_exists == 'true' && startsWith(github.ref, 'refs/heads/') && github.ref_name != 'main' && github.event.created
|
||||||
|
run: |
|
||||||
|
gh release create branch-$GITHUB_REF_NAME --latest=false --prerelease --title "PreBuild $GITHUB_REF_NAME" || true
|
||||||
|
gh release upload branch-$GITHUB_REF_NAME --clobber dist/*
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
|
- name: Upload commit release
|
||||||
|
if: env.devbuild_exists == 'true' && startsWith(github.ref, 'refs/heads/') && github.event.created
|
||||||
|
continue-on-error: true
|
||||||
|
run: |
|
||||||
|
gh release create commit-$COMMIT_SHORT --latest=false --prerelease --title "PreBuild $COMMIT_SHORT"
|
||||||
|
gh release upload commit-$COMMIT_SHORT --clobber dist/*
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
RELEASE_TAG: ${{ env.release_tag }}
|
|
||||||
|
|
||||||
- name: Upload DevBuild to builds repo
|
- name: Upload DevBuild to builds repo
|
||||||
if: github.repository == 'Vendicated/Vencord'
|
if: env.devbuild_exists == 'true' && startsWith(github.ref, 'refs/heads/') && github.ref_name == 'main' && github.event.created
|
||||||
run: |
|
run: |
|
||||||
git config --global user.name "$USERNAME"
|
git config --global user.name "$USERNAME"
|
||||||
git config --global user.email actions@github.com
|
git config --global user.email actions@github.com
|
||||||
|
|
|
@ -40,6 +40,7 @@ export default {
|
||||||
},
|
},
|
||||||
|
|
||||||
updater: {
|
updater: {
|
||||||
|
setUpdateSource: (source: "latest" | "branch" | "commit", name: string) => invoke<void>(IpcEvents.SET_UPDATE_SOURCE, source, name),
|
||||||
getUpdates: () => invoke<IpcRes<Record<"hash" | "author" | "message", string>[]>>(IpcEvents.GET_UPDATES),
|
getUpdates: () => invoke<IpcRes<Record<"hash" | "author" | "message", string>[]>>(IpcEvents.GET_UPDATES),
|
||||||
update: () => invoke<IpcRes<boolean>>(IpcEvents.UPDATE),
|
update: () => invoke<IpcRes<boolean>>(IpcEvents.UPDATE),
|
||||||
rebuild: () => invoke<IpcRes<boolean>>(IpcEvents.BUILD),
|
rebuild: () => invoke<IpcRes<boolean>>(IpcEvents.BUILD),
|
||||||
|
|
|
@ -25,6 +25,7 @@ import { promisify } from "util";
|
||||||
import { serializeErrors } from "./common";
|
import { serializeErrors } from "./common";
|
||||||
|
|
||||||
const VENCORD_SRC_DIR = join(__dirname, "..");
|
const VENCORD_SRC_DIR = join(__dirname, "..");
|
||||||
|
const REMOTE_NAME = "origin";
|
||||||
|
|
||||||
const execFile = promisify(cpExecFile);
|
const execFile = promisify(cpExecFile);
|
||||||
|
|
||||||
|
@ -40,7 +41,7 @@ function git(...args: string[]) {
|
||||||
}
|
}
|
||||||
|
|
||||||
async function getRepo() {
|
async function getRepo() {
|
||||||
const res = await git("remote", "get-url", "origin");
|
const res = await git("remote", "get-url", REMOTE_NAME);
|
||||||
return res.stdout.trim()
|
return res.stdout.trim()
|
||||||
.replace(/git@(.+):/, "https://$1/")
|
.replace(/git@(.+):/, "https://$1/")
|
||||||
.replace(/\.git$/, "");
|
.replace(/\.git$/, "");
|
||||||
|
@ -51,10 +52,10 @@ async function calculateGitChanges() {
|
||||||
|
|
||||||
const branch = (await git("branch", "--show-current")).stdout.trim();
|
const branch = (await git("branch", "--show-current")).stdout.trim();
|
||||||
|
|
||||||
const existsOnOrigin = (await git("ls-remote", "origin", branch)).stdout.length > 0;
|
const existsOnRemote = (await git("ls-remote", REMOTE_NAME, branch)).stdout.length > 0;
|
||||||
if (!existsOnOrigin) return [];
|
if (!existsOnRemote) return [];
|
||||||
|
|
||||||
const res = await git("log", `HEAD...origin/${branch}`, "--pretty=format:%an/%h/%s");
|
const res = await git("log", `HEAD...${REMOTE_NAME}/${branch}`, "--pretty=format:%an/%h/%s");
|
||||||
|
|
||||||
const commits = res.stdout.trim();
|
const commits = res.stdout.trim();
|
||||||
return commits ? commits.split("\n").map(line => {
|
return commits ? commits.split("\n").map(line => {
|
||||||
|
@ -84,7 +85,12 @@ async function build() {
|
||||||
return !res.stderr.includes("Build failed");
|
return !res.stderr.includes("Build failed");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function setUpdateSource() {
|
||||||
|
// noop
|
||||||
|
}
|
||||||
|
|
||||||
ipcMain.handle(IpcEvents.GET_REPO, serializeErrors(getRepo));
|
ipcMain.handle(IpcEvents.GET_REPO, serializeErrors(getRepo));
|
||||||
ipcMain.handle(IpcEvents.GET_UPDATES, serializeErrors(calculateGitChanges));
|
ipcMain.handle(IpcEvents.GET_UPDATES, serializeErrors(calculateGitChanges));
|
||||||
ipcMain.handle(IpcEvents.UPDATE, serializeErrors(pull));
|
ipcMain.handle(IpcEvents.UPDATE, serializeErrors(pull));
|
||||||
ipcMain.handle(IpcEvents.BUILD, serializeErrors(build));
|
ipcMain.handle(IpcEvents.BUILD, serializeErrors(build));
|
||||||
|
ipcMain.handle(IpcEvents.SET_UPDATE_SOURCE, serializeErrors(setUpdateSource));
|
||||||
|
|
|
@ -30,6 +30,7 @@ import { serializeErrors, VENCORD_FILES } from "./common";
|
||||||
|
|
||||||
const API_BASE = `https://api.github.com/repos/${gitRemote}`;
|
const API_BASE = `https://api.github.com/repos/${gitRemote}`;
|
||||||
let PendingUpdates = [] as [string, string][];
|
let PendingUpdates = [] as [string, string][];
|
||||||
|
let UpdateSource = { release: "latest", ref: "HEAD" };
|
||||||
|
|
||||||
async function githubGet(endpoint: string) {
|
async function githubGet(endpoint: string) {
|
||||||
return get(API_BASE + endpoint, {
|
return get(API_BASE + endpoint, {
|
||||||
|
@ -84,7 +85,14 @@ async function applyUpdates() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function setUpdateSource(source: "latest" | "branch" | "commit", name: string) {
|
||||||
|
if (source === "latest") UpdateSource = { release: "latest", ref: "HEAD" };
|
||||||
|
else if (source === "branch") UpdateSource = { release: `/tags/branch-${name}`, ref: `refs/heads/${name}` };
|
||||||
|
else if (source === "commit") UpdateSource = { release: `/tags/commit-${name}`, ref: name };
|
||||||
|
}
|
||||||
|
|
||||||
ipcMain.handle(IpcEvents.GET_REPO, serializeErrors(() => `https://github.com/${gitRemote}`));
|
ipcMain.handle(IpcEvents.GET_REPO, serializeErrors(() => `https://github.com/${gitRemote}`));
|
||||||
ipcMain.handle(IpcEvents.GET_UPDATES, serializeErrors(calculateGitChanges));
|
ipcMain.handle(IpcEvents.GET_UPDATES, serializeErrors(calculateGitChanges));
|
||||||
ipcMain.handle(IpcEvents.UPDATE, serializeErrors(fetchUpdates));
|
ipcMain.handle(IpcEvents.UPDATE, serializeErrors(fetchUpdates));
|
||||||
ipcMain.handle(IpcEvents.BUILD, serializeErrors(applyUpdates));
|
ipcMain.handle(IpcEvents.BUILD, serializeErrors(applyUpdates));
|
||||||
|
ipcMain.handle(IpcEvents.SET_UPDATE_SOURCE, serializeErrors(setUpdateSource));
|
||||||
|
|
|
@ -32,6 +32,7 @@ export const enum IpcEvents {
|
||||||
SET_SETTINGS = "VencordSetSettings",
|
SET_SETTINGS = "VencordSetSettings",
|
||||||
OPEN_EXTERNAL = "VencordOpenExternal",
|
OPEN_EXTERNAL = "VencordOpenExternal",
|
||||||
OPEN_QUICKCSS = "VencordOpenQuickCss",
|
OPEN_QUICKCSS = "VencordOpenQuickCss",
|
||||||
|
SET_UPDATE_SOURCE = "VencordSetUpdateSource",
|
||||||
GET_UPDATES = "VencordGetUpdates",
|
GET_UPDATES = "VencordGetUpdates",
|
||||||
GET_REPO = "VencordGetRepo",
|
GET_REPO = "VencordGetRepo",
|
||||||
UPDATE = "VencordUpdate",
|
UPDATE = "VencordUpdate",
|
||||||
|
|
Loading…
Add table
Reference in a new issue