Bladeren bron

[skip ci] Add changelogs

Yann Stepienik 2 jaren geleden
bovenliggende
commit
592470d330
3 gewijzigde bestanden met toevoegingen van 52 en 4 verwijderingen
  1. 5 0
      changelog.md
  2. 41 4
      sponsors.js
  3. 6 0
      tag.js

+ 5 - 0
changelog.md

@@ -0,0 +1,5 @@
+## Version 0.1.15 
+ - Ports is now freetype, in case container does not expose any
+ - Container picker now tries to pick the best port as default
+ - Hostname now default to container name
+ - Additional UI improvements

+ 41 - 4
sponsors.js

@@ -1,6 +1,7 @@
 const tokens = require('./tokens.json')
 const sponsors = require('@jamesives/github-sponsors-readme-action')
-const fs = require('fs').promises
+const fs = require('fs')
+const packageJson = require('./package.json')
 
 let configuration = {
   token: tokens.github,
@@ -23,7 +24,7 @@ const sponsorsGenerate = async () => {
   }
 
   // open the readme
-  const readme = await fs.readFile(configuration.file, 'utf8')
+  const readme = fs.readFileSync(configuration.file, 'utf8')
 
   // replace the sponsors marker with the new list
   const newReadme = readme.replace(
@@ -37,7 +38,7 @@ const sponsorsGenerate = async () => {
   )
 
   // write the new readme
-  await fs.writeFile(configuration.file, newReadme)
+  fs.writeFileSync(configuration.file, newReadme)
   
   // add to current commit by runnning shell command
   const { exec } = require('child_process')
@@ -51,4 +52,40 @@ const sponsorsGenerate = async () => {
 
   console.log(`Sponsors updated!`)
 }
-sponsorsGenerate()
+
+function changelog() {
+  // get the changes from last commit message
+  const { execSync } = require('child_process')
+  const commitMessage = execSync('git log -1 --pretty=%B').toString()
+  if(!commitMessage.toLocaleLowerCase().startsWith('[release]')) {
+    console.log('Not a release commit, skipping changelog update')
+    return
+  }
+  const version = packageJson.version
+ 
+  // open changelog.md
+  const changelog = fs.readFileSync('./changelog.md', 'utf8')
+  
+  // add the new changes to the top of the changelog
+  const newChangelog = `## Version ${version} \n ${commitMessage}\n\n${changelog}`
+  
+  // write the new changelog
+  fs.writeFileSync('./changelog.md', newChangelog)
+  
+  // add to current commit by runnning shell command
+  const { exec } = require('child_process')
+  const e = exec('git add changelog.md')
+  e.stdout.on('data', (data) => {
+    console.log(data)
+  })
+  e.stderr.on('data', (data) => {
+    console.error(data)
+  })
+}
+
+let isOnMaster = false;
+
+if(isOnMaster) {
+  sponsorsGenerate()
+}
+changelog();

+ 6 - 0
tag.js

@@ -2,6 +2,12 @@ const packageJson = require('./package.json');
 const { execSync } = require('child_process');
 
 function tagRelease() {
+  const commitMessage = execSync('git log -1 --pretty=%B').toString()
+  if(!commitMessage.toLocaleLowerCase().startsWith('[release]')) {
+    console.log('Not a release commit, skipping tag update')
+    return
+  }
+
   const version = packageJson.version;
   const tag = `v${version}`;
   const message = `Release ${tag}`;