get latestTag and add .version.plugins file

This commit is contained in:
tuntoja 2025-02-07 13:34:24 +01:00
parent cdc7bc93e5
commit e7067833d0
2 changed files with 36 additions and 1 deletions

View File

@ -251,7 +251,41 @@ jobs:
script: |
let version = '';
if ('${{ steps.get_stability.outputs.stability }}' === 'testing' || '${{ steps.get_stability.outputs.stability }}' === 'stable') {
if ${{ steps.get_stability.outputs.stability }}' === 'stable' {
const { owner, repo } = context.repo;
// Fetch the most recent tag for plugins
const { data: tags } = await github.rest.repos.listTags({
owner,
repo,
per_page: 1
});
let latestTag = null;
let latestDate = 0;
// Filter tags matching format plugins-YYYYMMDD
for (const tag of tags) {
const match = tag.name.match(/^plugins-(\d{8})$/);
// log non matching just for debug
if (!match) {
console.log(`Skipping non-matching tag: ${tag.name}`);
continue;
}
const tagDate = parseInt(match[1], 10);
// get latest tag
if (tagDate > latestDate) {
latestTag = tag.name;
latestDate = tagDate;
}
}
console.log("Most recent tag found: $latestTag")
} else if ('${{ steps.get_stability.outputs.stability }}' === 'testing') {
const branchName = "${{ github.ref_name }}";
const matches = branchName.match(/^(?:release|hotfix)-(\d{8})$/);
if (matches) {

1
.version.plugins Normal file
View File

@ -0,0 +1 @@
20250201