Smart changelog (#5205)

Added a smart Changelog :

- Publish the Changelog before the app release. If the release has not
yet been pushed to production, do not display it.
- When the app release is done, make the Changelog available with the
correct date.
- If the Changelog writing is delayed because the release has already
been made, publish it immediately.
- Display everything locally to be able to iterate on the changelog and
have a preview

Added an endpoint for the Changelog

---------

Co-authored-by: Ady Beraud <a.beraud96@gmail.com>
Co-authored-by: Félix Malfait <felix.malfait@gmail.com>
This commit is contained in:
Ady Beraud
2024-05-01 09:35:11 +03:00
committed by GitHub
parent bf7c4a5a89
commit df5cb9a904
17 changed files with 232 additions and 11 deletions

View File

@ -22,7 +22,10 @@ const findOne = (model: any, orderBy: any) => {
return pgDb.select().from(model).orderBy(orderBy).limit(1).execute();
};
const findAll = (model: any) => {
const findAll = (model: any, orderBy?: any) => {
if (orderBy) {
return pgDb.select().from(model).orderBy(orderBy).execute();
}
return pgDb.select().from(model).execute();
};

View File

@ -0,0 +1,8 @@
import { migrate } from '@/database/database';
export const initDatabase = async () => {
await migrate();
process.exit(0);
};
initDatabase();

View File

@ -0,0 +1,9 @@
CREATE TABLE IF NOT EXISTS "githubReleases" (
"tagName" text PRIMARY KEY NOT NULL,
"publishedAt" date NOT NULL
);
--> statement-breakpoint
CREATE TABLE IF NOT EXISTS "githubStars" (
"timestamp" timestamp DEFAULT now() NOT NULL,
"numberOfStars" integer
);

View File

@ -15,6 +15,13 @@
"when": 1713792223113,
"tag": "0001_marvelous_eddie_brock",
"breakpoints": true
},
{
"idx": 2,
"version": "5",
"when": 1714375499735,
"tag": "0002_demonic_matthew_murdock",
"breakpoints": true
}
]
}

View File

@ -1,4 +1,5 @@
import {
pgGithubReleasesModel,
pgGithubStars,
pgIssueLabels,
pgIssues,
@ -16,6 +17,7 @@ export const pullRequestLabelModel = pgPullRequestLabels;
export const issueLabelModel = pgIssueLabels;
export const githubStarsModel = pgGithubStars;
export const githubReleasesModel = pgGithubReleasesModel;
export type User = typeof pgUsers.$inferSelect;
export type PullRequest = typeof pgPullRequests.$inferSelect;
@ -31,3 +33,4 @@ export type LabelInsert = typeof pgLabels.$inferInsert;
export type PullRequestLabelInsert = typeof pgPullRequestLabels.$inferInsert;
export type IssueLabelInsert = typeof pgIssueLabels.$inferInsert;
export type GithubStars = typeof pgGithubStars.$inferInsert;
export type GithubReleases = typeof pgGithubReleasesModel.$inferInsert;

View File

@ -1,4 +1,4 @@
import { integer, pgTable, text, timestamp } from 'drizzle-orm/pg-core';
import { date, integer, pgTable, text, timestamp } from 'drizzle-orm/pg-core';
export const pgUsers = pgTable('users', {
id: text('id').primaryKey(),
@ -55,3 +55,8 @@ export const pgGithubStars = pgTable('githubStars', {
timestamp: timestamp('timestamp').notNull().defaultNow(),
numberOfStars: integer('numberOfStars'),
});
export const pgGithubReleasesModel = pgTable('githubReleases', {
tagName: text('tagName').primaryKey(),
publishedAt: date('publishedAt', { mode: 'string' }).notNull(),
});