From 62ee0fec7371bede8d8f16cd81a199b1e3f7fac9 Mon Sep 17 00:00:00 2001 From: John Bintz <27256+johnbintz@users.noreply.github.com> Date: Fri, 15 Oct 2021 15:53:57 -0400 Subject: [PATCH] Add script to update changelogs --- .sandstorm/changelog.md | 4 ++++ README.md | 1 + bin/update_changelogs | 28 ++++++++++++++++++++++++++++ 3 files changed, 33 insertions(+) mode change 100644 => 100755 bin/update_changelogs diff --git a/.sandstorm/changelog.md b/.sandstorm/changelog.md index c609921..1acff58 100644 --- a/.sandstorm/changelog.md +++ b/.sandstorm/changelog.md @@ -1,3 +1,7 @@ +## 0.88.1~2021-10-10 + +* Upgrade Hugo to 0.88.1 extended + ## 0.79.1~2020-12-22 * Upgrade Hugo to 0.79.1 to deal with security issue diff --git a/README.md b/README.md index e221532..e94cf32 100644 --- a/README.md +++ b/README.md @@ -41,6 +41,7 @@ store you would need either the original app key or ## Pack and publish +* Run `bin/update_changelogs` to update changelogs for the package * Run `bin/pack_hugo` to create an spk in the parent directory to ths one * Try loading that spk into a separate Sandstorm instance for testing * If it works, run `bin/publish_hugo` to publish that version to the App Market diff --git a/bin/update_changelogs b/bin/update_changelogs old mode 100644 new mode 100755 index e69de29..13ab542 --- a/bin/update_changelogs +++ b/bin/update_changelogs @@ -0,0 +1,28 @@ +#!/usr/bin/env ruby + +SANDSTORM_CHANGELOG = ".sandstorm/changelog.md" +CHANGELOG = "CHANGELOG.md" + +SANDSTORM_VERSION_FILE = ".sandstorm/app-marketing-version" +HUGO_VERSION_FILE = "hugo-version" + +HUGO_VERSION = File.read(HUGO_VERSION_FILE).chomp + +[ + [SANDSTORM_CHANGELOG, SANDSTORM_VERSION_FILE], + [CHANGELOG, HUGO_VERSION_FILE] +].each do |(changelog, version_file)| + data = File.readlines(changelog).map(&:chomp) + version = File.read(version_file).chomp + + unless data.any? { |line| line[version] } + data = [ + "## #{version}", + "", + "* Upgrade Hugo to #{HUGO_VERSION} extended", + "" + ].concat(data) + + File.open(changelog, 'w') { |fh| fh.print data.join("\n") + "\n" } + end +end