Skip to content

Commit

Permalink
get latestTag and add .version.plugins file
Browse files Browse the repository at this point in the history
  • Loading branch information
tuntoja committed Feb 7, 2025
1 parent cdc7bc9 commit e706783
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 1 deletion.
36 changes: 35 additions & 1 deletion .github/workflows/get-environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
1 change: 1 addition & 0 deletions .version.plugins
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
20250201

0 comments on commit e706783

Please sign in to comment.