-
-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
154 additions
and
11 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
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,33 @@ | ||
name: Make release | ||
|
||
on: | ||
push: | ||
tags: | ||
- v* | ||
branches: | ||
- docker | ||
|
||
jobs: | ||
push-store-image: | ||
runs-on: ubuntu-latest | ||
defaults: | ||
run: | ||
working-directory: "." | ||
steps: | ||
- name: "Checkout GitHub Action" | ||
uses: actions/checkout@main | ||
|
||
- name: "Run release script" | ||
run: npm i && node scripts/gh-release.js | ||
|
||
- name: get-npm-version | ||
id: package-version | ||
uses: martinbeentjes/npm-get-version-action@v1.3.1 | ||
|
||
- name: "Release" | ||
uses: softprops/action-gh-release@v1 | ||
with: | ||
body_path: release-notes.md | ||
files: ./release/*.zip | ||
name: Unchained v${{ steps.package-version.outputs.current-version }} | ||
tag_name: v${{ steps.package-version.outputs.current-version }} |
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 |
---|---|---|
|
@@ -4,3 +4,5 @@ conf.*.yaml | |
.env | ||
dist | ||
data | ||
release | ||
release-notes.md |
File renamed without changes.
File renamed without changes.
File renamed without changes.
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
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,65 @@ | ||
import { writeFileSync, readFileSync, mkdirSync, copyFileSync } from "fs"; | ||
import { dirname } from "path"; | ||
import { execSync } from "child_process"; | ||
|
||
const packageJson = JSON.parse(readFileSync("./package.json")); | ||
|
||
const about = [ | ||
"Unchained is a decentralized, peer-to-peer network for data validation.", | ||
"Unchained nodes work to validate data together and are rewarded in KNS tokens.", | ||
"The validated data can then be queried by consumer in exchange for KNS tokens.", | ||
"Learn more about Unchained [here](https://kenshi.io/docs/unchained).", | ||
].join(" "); | ||
|
||
const questions = [ | ||
"Have any questions? Ask in the [forum](https://forum.kenshi.io/c/unchained),", | ||
"in our [chat](https://t.me/KenshiTech/85602), or send us an", | ||
"[email](mailto:hi@kenshi.io).", | ||
].join(" "); | ||
|
||
const releaseTemplate = (changes) => `\ | ||
${about} | ||
${questions} | ||
${changes} | ||
`; | ||
|
||
const makeReleaseNotes = async () => { | ||
const url = | ||
"https://app.whatthediff.ai/changelog/github/KenshiTech/unchained.json"; | ||
const req = await fetch(url); | ||
const notes = await req.json(); | ||
const wtd = notes.changelog.data[0]; | ||
|
||
const changes = wtd.comment.replace(/^## PR Summary/, "## Changes"); | ||
const release = releaseTemplate(changes); | ||
|
||
writeFileSync("./release-notes.md", release); | ||
}; | ||
|
||
const makeReleaseFile = (name, files) => { | ||
const dirName = `unchained-v${packageJson.version}-${name}`; | ||
mkdirSync(`release/${dirName}`, { recursive: true }); | ||
for (const { source, target } of files) { | ||
const dirToMake = dirname(target); | ||
if (dirToMake !== ".") { | ||
mkdirSync(`release/${dirName}/${dirToMake}`, { recursive: true }); | ||
} | ||
copyFileSync(source, `release/${dirName}/${target}`); | ||
} | ||
execSync(`cd release && zip -r ${dirName}.zip ${dirName}`); | ||
}; | ||
|
||
await makeReleaseNotes(); | ||
mkdirSync("./release", { recursive: true }); | ||
makeReleaseFile("docker", [ | ||
{ source: "docker/compose.yaml", target: "compose.yaml" }, | ||
{ source: "docker/Dockerfile", target: "Dockerfile" }, | ||
{ source: "docker/scripts/start_node.sh", target: "scripts/start_node.sh" }, | ||
{ source: "docker/scripts/stop_node.sh", target: "scripts/stop_node.sh" }, | ||
{ source: "docker/scripts/view_node.sh", target: "scripts/view_node.sh" }, | ||
{ source: ".env.template", target: ".env.template" }, | ||
{ source: "conf.yaml.template", target: "conf.yaml.template" }, | ||
{ source: "LICENSE", target: "LICENSE" }, | ||
]); |