Skip to content

Commit ab52980

Browse files
committed
Updated GitHub workflows
1 parent cf732cd commit ab52980

File tree

4 files changed

+45
-6
lines changed

4 files changed

+45
-6
lines changed

.github/workflows/prepare-release.yaml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,11 @@ on:
1010

1111
jobs:
1212
test:
13-
name: Build storybook - test
13+
name: Prepare releases
1414
runs-on: ubuntu-latest
15+
env:
16+
# Ensure that Chalk uses colors in the output
17+
FORCE_COLOR: 2
1518
steps:
1619

1720
- name: Check out repository

scripts/publish-helpers/status.ts

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,8 @@ function buildModuleDiffCommand(pkg, flags = "", tag = null) {
149149
function moduleHasChangesSinceTag(pkg): boolean | null {
150150
/** Check if a module has changes since the tag matching the current release */
151151
try {
152+
fetchTagIfNotExistsLocally(pkg);
153+
152154
execSync(buildModuleDiffCommand(pkg, "--exit-code"), { stdio: "ignore" });
153155
// if the command exits with 0, there are no changes
154156
return false;
@@ -163,6 +165,27 @@ function moduleHasChangesSinceTag(pkg): boolean | null {
163165
}
164166
}
165167

168+
function fetchTagIfNotExistsLocally(pkg) {
169+
/** Fetch the tag from the remote if it doesn't exist locally */
170+
const tag = moduleString(pkg, "-v");
171+
172+
// Check if the tag exists locally
173+
const localTag = execSync(`git tag --list ${tag}`).toString().trim();
174+
if (localTag !== "") {
175+
return;
176+
}
177+
178+
const cmd = `git fetch origin tag ${tag} --no-tags`;
179+
try {
180+
execSync(cmd, { stdio: "ignore" });
181+
} catch (error) {
182+
// If the tag doesn't exist, this will throw an error
183+
if (error.status === 128) {
184+
console.log(chalk.red(`Tag ${tag} does not exist on remote.`));
185+
}
186+
}
187+
}
188+
166189
function printChangeInfoForPublishedPackage(pkg, showChanges = false) {
167190
const cmd = buildModuleDiffCommand(pkg);
168191
console.log(chalk.bold(pkg.name), `has changes since v${pkg.version}.`);
@@ -175,6 +198,16 @@ function printChangeInfoForPublishedPackage(pkg, showChanges = false) {
175198

176199
console.log("Run the following command to see detailed changes:");
177200
console.log(chalk.dim(">"), chalk.dim(cmd));
201+
202+
// Check if is synced with the remote
203+
// TODO: this only works if the current branch is pushed to the remote
204+
console.log("or view the changes in GitHub:");
205+
const repoUrl = "https://github.com/UW-Macrostrat/web-components";
206+
const tag = moduleString(pkg, "-v");
207+
// Get head commit hash
208+
const headCommit = execSync("git rev-parse HEAD").toString().trim();
209+
const url = `${repoUrl}/compare/${tag}...${headCommit}`;
210+
console.log(chalk.dim(url));
178211
}
179212

180213
/* checks for unstaged changes */
@@ -228,6 +261,9 @@ export async function checkIfPackageCanBePublished(
228261
}
229262

230263
function checkForChangelogEntry(pkg: PackageData) {
264+
/** Check whether the package has a changelog entry for the current version
265+
*/
266+
231267
const dir = getPackageDirectory(pkg.name);
232268
const changelogPath = path.join(dir, "CHANGELOG.md");
233269
const CHANGELOG = chalk.bold("CHANGELOG");
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
# Changelog
22

3-
[1.0.1] - 2025-06-25
3+
## [1.0.1] - 2025-06-25
44

55
Update Parcel bundling
66

7-
[1.0.0] - 2025-02-14
7+
## [1.0.0] - 2025-02-14
88

99
- Initial release
1010
- Guide users to Vite and `@macrostrat/vite-plugin-hyperstyles`
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
# Changelog
22

3-
[1.0.2] - 2025-06-25
3+
## [1.0.2] - 2025-06-25
44

55
Update required Vite version.
66

7-
[1.0.1] - 2025-02-14
7+
## [1.0.1] - 2025-02-14
88

99
Updated compilation pipeline
1010

11-
[1.0.0] - 2024-10-24
11+
## [1.0.0] - 2024-10-24
1212

1313
Initial release

0 commit comments

Comments
 (0)