-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: Updated release process to include sponsorship suffix
- Loading branch information
1 parent
af55287
commit 72f5a30
Showing
7 changed files
with
109 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
const bodySuffix = "---\nEnjoying the integration? Why not make a one time or monthly [GitHub sponsorship](https://github.com/sponsors/bottlecapdave)?" | ||
|
||
async function createGithubRelease(githubToken: string, githubOwnerRepo: string, tag: string, notes: string) { | ||
if (!githubToken) { | ||
throw new Error('Github token not specified'); | ||
} | ||
|
||
if (!githubOwnerRepo) { | ||
throw new Error('Github owner/repo not specified'); | ||
} | ||
|
||
if (!tag) { | ||
throw new Error('Tag not specified'); | ||
} | ||
|
||
if (!notes) { | ||
throw new Error('Notes not specified'); | ||
} | ||
|
||
console.log(`Publishing ${tag} release to ${githubOwnerRepo}`); | ||
|
||
const body = JSON.stringify({ | ||
tag_name: tag, | ||
name: tag, | ||
body: notes, | ||
draft: false, | ||
prerelease:false | ||
}); | ||
|
||
const response = await fetch( | ||
`https://api.github.com/repos/${githubOwnerRepo}/releases`, | ||
{ | ||
method: 'POST', | ||
headers: { | ||
"Accept": "application/vnd.github+json", | ||
"Authorization": `Bearer ${githubToken}`, | ||
"X-GitHub-Api-Version": "2022-11-28" | ||
}, | ||
body | ||
} | ||
); | ||
|
||
if (response.status >= 300) { | ||
throw new Error(response.statusText); | ||
} | ||
} | ||
|
||
createGithubRelease( | ||
process.env.GITHUB_TOKEN, | ||
process.env.GITHUB_REPOSITORY, | ||
process.argv[2], | ||
`${process.argv[3]}\n${bodySuffix}` | ||
).then(() => console.log('Success')); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"compilerOptions": { | ||
"alwaysStrict": true, | ||
"module": "commonjs", | ||
"noImplicitAny": true, | ||
"removeComments": true, | ||
"preserveConstEnums": true, | ||
"sourceMap": true, | ||
|
||
}, | ||
"include": ["**/*"] | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { readFileSync, writeFileSync } from 'fs'; | ||
import { join } from 'path'; | ||
|
||
const filePath = join(__dirname, '../custom_components/harvest_time_tracker/manifest.json'); | ||
|
||
function updateManifest(version: string) { | ||
|
||
const buffer = readFileSync(filePath); | ||
const content = JSON.parse(buffer.toString()); | ||
content.version = version; | ||
|
||
writeFileSync(filePath, JSON.stringify(content, null, 2)); | ||
console.log(`Updated version to '${version}'`); | ||
} | ||
|
||
updateManifest(process.argv[2]); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters