Skip to content

Commit

Permalink
Update release generation script to use ES
Browse files Browse the repository at this point in the history
  • Loading branch information
muffinista committed Mar 9, 2024
1 parent c4473dc commit 31ef9d2
Show file tree
Hide file tree
Showing 3 changed files with 209 additions and 23 deletions.
24 changes: 16 additions & 8 deletions bin/generate-release.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,20 @@
#!/usr/bin/env node

/* eslint-disable no-console */
require("dotenv").config();
import "dotenv/config";
import * as path from "path";
import { Octokit } from "octokit";
import { readFile } from 'fs/promises';
import { fileURLToPath } from 'url';

import SentryCli from '@sentry/cli';
const pjson = JSON.parse(
await readFile(
new URL('../package.json', import.meta.url)
)
);

const __dirname = path.dirname(fileURLToPath(import.meta.url));

const SentryCli = require("@sentry/cli");
const { Octokit } = require("@octokit/rest");
const path = require("path");
const pjson = require(path.join(__dirname, "..", "package.json"));

let opts = {
auth: `token ${process.env.GITHUB_AUTH_TOKEN}`
Expand Down Expand Up @@ -35,15 +43,15 @@ async function main() {

console.log(`checking ${owner}/${repo} for ${tag_name}`);

let result = await octokit.repos.getLatestRelease({owner, repo});
let result = await octokit.rest.repos.getLatestRelease({owner, repo});
if ( result.data.tag_name === tag_name ) {
console.log("release already created!");
}
else {
console.log(release);

// Create a release
result = await octokit.repos.createRelease(release);
result = await octokit.rest.repos.createRelease(release);
console.log(result);
}

Expand Down
206 changes: 192 additions & 14 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
"@babel/preset-env": "^7.7.1",
"@electron/rebuild": "^3.6.0",
"octokit": "^3.1.2",
"@sentry/cli": "^2.1.0",
"@sentry/cli": "^2.30.0",
"@sentry/webpack-plugin": "^1.18.9",
"babel-loader": "^9.1.2",
"babel-plugin-transform-object-rest-spread": "^6.26.0",
Expand Down

0 comments on commit 31ef9d2

Please sign in to comment.