mirror of
https://github.com/Alfresco/alfresco-content-app.git
synced 2025-05-12 17:04:46 +00:00
[ACS-7970] Add the option to select a tag for ADF upstream (#4054)
This commit is contained in:
parent
86fb96579b
commit
a022829e44
10
.github/workflows/upstream-adf.yml
vendored
10
.github/workflows/upstream-adf.yml
vendored
@ -3,6 +3,12 @@ on:
|
||||
schedule:
|
||||
- cron: '0 */3 * * *' # “At minute 0 past every 3rd hour.”
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
tag:
|
||||
description: 'Type of the tag the latest version should be fetched with'
|
||||
required: false
|
||||
type: string
|
||||
default: 'alpha'
|
||||
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.BOT_GITHUB_TOKEN }}
|
||||
@ -30,11 +36,11 @@ jobs:
|
||||
github-token: ${{ secrets.BOT_GITHUB_TOKEN }}
|
||||
script: |
|
||||
const getLatestVersionOf = require('./scripts/gh/update/latest-version-of.js');
|
||||
const { hasNewVersion: hasNewADFVersion , remoteVersion: latestADFVersion } = await getLatestVersionOf({exec, github, dependencyName: 'adf-core'});
|
||||
const { hasNewVersion: hasNewADFVersion , remoteVersion: latestADFVersion } = await getLatestVersionOf({exec, github, dependencyName: 'adf-core', tag: '${{ inputs.tag }}'});
|
||||
console.log('hasNewADFVersion', hasNewADFVersion);
|
||||
console.log('latestADFVersion', latestADFVersion?.name);
|
||||
|
||||
const { hasNewVersion: hasNewJSVersion, remoteVersion: latestJSVersion } = await getLatestVersionOf({exec, github, dependencyName: 'js-api'});
|
||||
const { hasNewVersion: hasNewJSVersion, remoteVersion: latestJSVersion } = await getLatestVersionOf({exec, github, dependencyName: 'js-api', tag: '${{ inputs.tag }}'});
|
||||
console.log('hasNewJSVersion', hasNewJSVersion);
|
||||
console.log('latestJSVersion', latestJSVersion?.name);
|
||||
if (hasNewADFVersion === 'true' || hasNewJSVersion === 'true' ) {
|
||||
|
@ -2,7 +2,7 @@ function inDays(d1, d2) {
|
||||
return Math.floor((d2.getTime() - d1.getTime()) / (24 * 3600 * 1000));
|
||||
}
|
||||
|
||||
module.exports = async ({ exec, github, dependencyName }) => {
|
||||
module.exports = async ({ exec, github, dependencyName, tag }) => {
|
||||
const organization = 'alfresco';
|
||||
const dependencyFullName = `@${organization}/${dependencyName}`;
|
||||
const pkg = require('../../../package.json');
|
||||
@ -15,7 +15,6 @@ module.exports = async ({ exec, github, dependencyName }) => {
|
||||
org: organization
|
||||
});
|
||||
|
||||
let latestPkgToUpdate = availablePackages[0];
|
||||
const options = {};
|
||||
let packageDistTag = '';
|
||||
options.listeners = {
|
||||
@ -25,17 +24,13 @@ module.exports = async ({ exec, github, dependencyName }) => {
|
||||
};
|
||||
await exec.exec(`npm dist-tag ls @alfresco/${dependencyName}`, [], options);
|
||||
const tagsType = packageDistTag.split('\n');
|
||||
const latestPkgTag = tagsType.find((tag) => tag.includes(latestPkgToUpdate.name))?.split(':')[0];
|
||||
|
||||
if (latestPkgTag !== 'alpha') {
|
||||
const alphaPackageVersion = tagsType.find((tag) => tag.includes('alpha'))?.split(':')[1].trim();
|
||||
latestPkgToUpdate = availablePackages.find((item) => item.name === alphaPackageVersion);
|
||||
}
|
||||
const matchedPkgVersion = tagsType.find((tagType) => tagType.includes(tag))?.split(':')[1].trim();
|
||||
const latestPkgToUpdate = availablePackages.find((package) => package.name === matchedPkgVersion);
|
||||
|
||||
if (localVersion === latestPkgToUpdate?.name) {
|
||||
return { hasNewVersion: 'false' };
|
||||
} else {
|
||||
const findLocalVersionOnRemote = availablePackages.find((item) => item.name === localVersion);
|
||||
const findLocalVersionOnRemote = availablePackages.find((package) => package.name === localVersion);
|
||||
let rangeInDays = 'N/A';
|
||||
if (findLocalVersionOnRemote !== undefined) {
|
||||
const creationLocal = new Date(findLocalVersionOnRemote.created_at);
|
||||
|
Loading…
x
Reference in New Issue
Block a user