Skip to content

Commit

Permalink
add auth changelog file
Browse files Browse the repository at this point in the history
  • Loading branch information
paulinaaniola committed May 21, 2024
1 parent 4c2812f commit d9223fd
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 7 deletions.
27 changes: 27 additions & 0 deletions .github/scripts/CheckChangelogs.main.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/usr/bin/env kotlin

@file:DependsOn("com.fasterxml.jackson.module:jackson-module-kotlin:2.17.0")

import com.fasterxml.jackson.module.kotlin.jacksonObjectMapper
import com.fasterxml.jackson.module.kotlin.readValue
import java.io.File

data class Module(val name: String, val version: String)

val modulesWithVersionsJson = args[0]

val modules: List<Module> = jacksonObjectMapper().readValue(modulesWithVersionsJson)

for (module in modules) {
val moduleName = module.name
val version = module.version
val pattern = Regex("## \\[$version\\]")
val changelogContent = File("./$moduleName/CHANGELOG.md").readText()
if (pattern.containsMatchIn(changelogContent)) {
println("✅ Version string $version found in CHANGELOG.md for module $moduleName")
} else {
println("⛔️ String $version not found in CHANGELOG.md for module $moduleName")
System.exit(1)
}
}

11 changes: 5 additions & 6 deletions .github/workflows/check-changelog-files.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,15 @@ jobs:
# check-version-bump exits with 0 if it detects a bump, otherwise with 1
if [ $? != "1" ] && [[ ! " ${modules_list[*]} " =~ " ${file} " ]]; then
version="$(cat $file | jq -r '.version')"
modules_list+=("{\"name\": \"$file\", \"version\": \"$version\"}")
modules_list+=("{\"name\": \"${file%"/package.json"}\", \"version\": \"$version\"}")
fi
done
jsonString="$(jq --compact-output --null-input '$ARGS.positional' --args -- "${modules_list[@]}")"
echo 'miko'
echo $jsonString
echo "modules=$jsonString" >> $GITHUB_OUTPUT
# - name: Check changelog files
# if: ${{ steps.get-modules-with-increased-version.outputs.modules != '' }}
# run: |
# kotlinc -script .github/scripts/CheckChangelogs.main.kts ${{ steps.get-modules-with-increased-version.outputs.modules}}
- name: Check changelog files
if: ${{ steps.build-matrix.outputs.modules != '' }}
run: |
kotlinc -script .github/scripts/CheckChangelogs.main.kts ${{ steps.build-matrix.outputs.modules}}
8 changes: 8 additions & 0 deletions packages/auth/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Changelog

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [1.4.0] - 2024-05-21
2 changes: 1 addition & 1 deletion packages/auth/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@tidal-music/auth",
"version": "1.4.1",
"version": "1.4.2",
"type": "module",
"files": [
"dist"
Expand Down

0 comments on commit d9223fd

Please sign in to comment.