Skip to content

Commit

Permalink
- upgraded the node version for the action from node12 to 16
Browse files Browse the repository at this point in the history
- added new code to support release-x.x.x format on top of release/x.x.x
  • Loading branch information
Rafael Gil committed Oct 4, 2023
1 parent 2914201 commit bee8ea9
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 14 deletions.
2 changes: 1 addition & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@ outputs:
manifestSafeVersionString:
description: 'A version string that is save to use in Dnn manifests'
runs:
using: 'node12'
using: 'node16'
main: './dist/index.js'
25 changes: 12 additions & 13 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
import * as core from '@actions/core';
import * as github from '@actions/github';

const getVersion = async (version: string): Promise<Version> => {
const numbers = version.split('.');
console.log("numbers:", numbers);
const getVersion = async (version: Array<any>): Promise<Version> => {
console.log("version:", version);
return {
major: parseInt(numbers[0]),
minor: parseInt(numbers[1]),
patch: parseInt(numbers[2]),
major: parseInt(version[1]),
minor: parseInt(version[2]),
patch: parseInt(version[3]),
manifestSafeVersionString:
numbers[0].padStart(2, "0") + "." +
numbers[1].padStart(2, "0") + "." +
numbers[2].padStart(2, "0")
version[0].padStart(2, "0") + "." +
version[1].padStart(2, "0") + "." +
version[2].padStart(2, "0")
};
}

Expand All @@ -30,10 +29,10 @@ async function run() {

// Grab the branch version
const branchName: string = github.context.payload.ref;
const regex = new RegExp(/^release\/\d{1,2}\.\d{1,2}\.\d{1,2}$/);
if (branchName.match(regex)){
const versionString = branchName.split('/')[1];
const version = await getVersion(versionString);
const regex = new RegExp(/^release[-\/](\d{1,2})\.(\d{1,2})\.(\d{1,2})$/);
const releaseInfo = branchName.match(regex)
if (releaseInfo){
const version = await getVersion(releaseInfo);
console.log("version: ", version);
core.setOutput("major", version.major);
core.setOutput("minor", version.minor);
Expand Down

0 comments on commit bee8ea9

Please sign in to comment.