mirror of
https://github.com/Alfresco/alfresco-content-app.git
synced 2026-09-09 18:02:54 +00:00
Bumps the github-actions group with 7 updates: | Package | From | To | | --- | --- | --- | | [github/codeql-action](https://github.com/github/codeql-action) | `4` | `4.37.3` | | [Alfresco/alfresco-build-tools/.github/actions/free-hosted-runner-disk-space](https://github.com/alfresco/alfresco-build-tools) | `18.13.0` | `18.21.0` | | [Alfresco/alfresco-build-tools/.github/actions/kubectl-keep-nslogs](https://github.com/alfresco/alfresco-build-tools) | `18.13.0` | `18.21.0` | | [crowdin/github-action](https://github.com/crowdin/github-action) | `2.16.3` | `2.17.0` | | [Alfresco/alfresco-build-tools/.github/actions/get-commit-message](https://github.com/alfresco/alfresco-build-tools) | `18.13.0` | `18.21.0` | | [Alfresco/alfresco-build-tools/.github/actions/configure-git-author](https://github.com/alfresco/alfresco-build-tools) | `18.13.0` | `18.21.0` | | [actions/setup-node](https://github.com/actions/setup-node) | `6` | `7` | Updates `github/codeql-action` from 4 to 4.37.3 - [Release notes](https://github.com/github/codeql-action/releases) - [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md) - [Commits](https://github.com/github/codeql-action/compare/v4...v4.37.3) Updates `Alfresco/alfresco-build-tools/.github/actions/free-hosted-runner-disk-space` from 18.13.0 to 18.21.0 - [Release notes](https://github.com/alfresco/alfresco-build-tools/releases) - [Commits](https://github.com/alfresco/alfresco-build-tools/compare/10cea6c0b390c4f8af21d9dc1670d581bd10319f...e87345fb177248fc5bdc7838107f098438818df1) Updates `Alfresco/alfresco-build-tools/.github/actions/kubectl-keep-nslogs` from 18.13.0 to 18.21.0 - [Release notes](https://github.com/alfresco/alfresco-build-tools/releases) - [Commits](https://github.com/alfresco/alfresco-build-tools/compare/10cea6c0b390c4f8af21d9dc1670d581bd10319f...e87345fb177248fc5bdc7838107f098438818df1) Updates `crowdin/github-action` from 2.16.3 to 2.17.0 - [Release notes](https://github.com/crowdin/github-action/releases) - [Commits](https://github.com/crowdin/github-action/compare/52aa776766211d83d975df51f3b9c53c2f8ba35f...c7af9bc98b01694653031fef2a0dc6c7888ce9bc) Updates `Alfresco/alfresco-build-tools/.github/actions/get-commit-message` from 18.13.0 to 18.21.0 - [Release notes](https://github.com/alfresco/alfresco-build-tools/releases) - [Commits](https://github.com/alfresco/alfresco-build-tools/compare/10cea6c0b390c4f8af21d9dc1670d581bd10319f...e87345fb177248fc5bdc7838107f098438818df1) Updates `Alfresco/alfresco-build-tools/.github/actions/configure-git-author` from 18.13.0 to 18.21.0 - [Release notes](https://github.com/alfresco/alfresco-build-tools/releases) - [Commits](https://github.com/alfresco/alfresco-build-tools/compare/10cea6c0b390c4f8af21d9dc1670d581bd10319f...e87345fb177248fc5bdc7838107f098438818df1) Updates `actions/setup-node` from 6 to 7 - [Release notes](https://github.com/actions/setup-node/releases) - [Commits](https://github.com/actions/setup-node/compare/v6...v7) --- updated-dependencies: - dependency-name: github/codeql-action dependency-version: 4.37.3 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: github-actions - dependency-name: Alfresco/alfresco-build-tools/.github/actions/free-hosted-runner-disk-space dependency-version: 18.21.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: github-actions - dependency-name: Alfresco/alfresco-build-tools/.github/actions/kubectl-keep-nslogs dependency-version: 18.21.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: github-actions - dependency-name: crowdin/github-action dependency-version: 2.17.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: github-actions - dependency-name: Alfresco/alfresco-build-tools/.github/actions/get-commit-message dependency-version: 18.21.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: github-actions - dependency-name: Alfresco/alfresco-build-tools/.github/actions/configure-git-author dependency-version: 18.21.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: github-actions - dependency-name: actions/setup-node dependency-version: '7' dependency-type: direct:production update-type: version-update:semver-major dependency-group: github-actions ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
186 lines
9.1 KiB
YAML
186 lines
9.1 KiB
YAML
name: Upstream adf
|
|
on:
|
|
schedule:
|
|
- cron: '0 10,14,17 * * 1-5' #At 10,14,17 on every day-of-week from Monday through Friday.
|
|
workflow_dispatch:
|
|
inputs:
|
|
tag:
|
|
description: 'Type of the tag the latest version should be fetched with'
|
|
required: false
|
|
type: string
|
|
default: 'alpha'
|
|
|
|
jobs:
|
|
upstream:
|
|
runs-on: ubuntu-latest
|
|
outputs:
|
|
hasNewVersion: ${{ steps.fetchLatestPkg.outputs.hasNewVersion }}
|
|
hasNewADFVersion: ${{ steps.fetchLatestPkg.outputs.hasNewADFVersion }}
|
|
latestADFVersion: ${{ steps.fetchLatestPkg.outputs.latestADFVersion }}
|
|
hasNewJSVersion: ${{ steps.fetchLatestPkg.outputs.hasNewJSVersion }}
|
|
latestJSVersion: ${{ steps.fetchLatestPkg.outputs.latestJSVersion }}
|
|
hasNewVersionWithoutPR: ${{ steps.checkPrAlreadyExist.outputs.hasNewVersionWithoutPR }}
|
|
steps:
|
|
- id: checkoutRepo
|
|
name: Checkout repository
|
|
uses: actions/checkout@v7
|
|
with:
|
|
fetch-depth: 1
|
|
- name: Generate app token
|
|
id: app-token
|
|
uses: actions/create-github-app-token@bcd2ba49218906704ab6c1aa796996da409d3eb1 # v3.2.0
|
|
with:
|
|
client-id: ${{ vars.GH_APP_ENGINEERING_RO_CLIENT_ID }}
|
|
private-key: ${{ secrets.GH_APP_ENGINEERING_RO_PRIVATE_KEY }}
|
|
permission-contents: read
|
|
permission-pull-requests: read
|
|
- id: fetchLatestPkg
|
|
name: Fetch the latest package version
|
|
uses: actions/github-script@v9
|
|
with:
|
|
github-token: ${{ steps.app-token.outputs.token }}
|
|
script: |
|
|
const getLatestVersionOf = require('./scripts/gh/update/latest-version-of.js');
|
|
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', tag: '${{ inputs.tag }}'});
|
|
console.log('hasNewJSVersion', hasNewJSVersion);
|
|
console.log('latestJSVersion', latestJSVersion?.name);
|
|
if (hasNewADFVersion === 'true' || hasNewJSVersion === 'true' ) {
|
|
core.setOutput('hasNewVersion', 'true');
|
|
if (hasNewADFVersion === 'true') {
|
|
core.setOutput('hasNewADFVersion', 'true');
|
|
core.setOutput('latestADFVersion', latestADFVersion?.name);
|
|
}
|
|
if (hasNewJSVersion === 'true') {
|
|
core.setOutput('hasNewJSVersion', 'true');
|
|
core.setOutput('latestJSVersion', latestJSVersion?.name);
|
|
}
|
|
} else {
|
|
core.setOutput('hasNewVersion', 'false');
|
|
console.log('No new version available, skipping upstream!');
|
|
}
|
|
- name: Check value after
|
|
run: |
|
|
echo "The value hasNewVersion is: ${{ steps.fetchLatestPkg.outputs.hasNewVersion }}"
|
|
echo "The value hasNewADFVersion is: ${{ steps.fetchLatestPkg.outputs.hasNewADFVersion }}"
|
|
echo "The value latestADFVersion is: ${{ steps.fetchLatestPkg.outputs.latestADFVersion }}"
|
|
echo "The value hasNewJSVersion is: ${{ steps.fetchLatestPkg.outputs.hasNewJSVersion }}"
|
|
echo "The value latestJSVersion is: ${{ steps.fetchLatestPkg.outputs.latestJSVersion }}"
|
|
- id: checkPrAlreadyExist
|
|
name: Check if PR with latest already exist
|
|
if: ${{ steps.fetchLatestPkg.outputs.hasNewVersion == 'true' }}
|
|
uses: actions/github-script@v9
|
|
env:
|
|
HAS_NEW_ADF_VERSION: ${{ steps.fetchLatestPkg.outputs.hasNewADFVersion }}
|
|
LATEST_ADF_VERSION: ${{ steps.fetchLatestPkg.outputs.latestADFVersion }}
|
|
HAS_NEW_JS_VERSION: ${{ steps.fetchLatestPkg.outputs.hasNewJSVersion }}
|
|
LATEST_JS_VERSION: ${{ steps.fetchLatestPkg.outputs.latestJSVersion }}
|
|
with:
|
|
github-token: ${{ steps.app-token.outputs.token }}
|
|
script: |
|
|
// verify if there is already an Upstream PR pending
|
|
const hasNewADFVersion = process.env.HAS_NEW_ADF_VERSION;
|
|
const latestADFVersion = process.env.LATEST_ADF_VERSION;
|
|
const hasNewJSVersion = process.env.HAS_NEW_JS_VERSION;
|
|
const latestJSVersion = process.env.LATEST_JS_VERSION;
|
|
const checkPRAlreadyExist = require('./scripts/gh/update/check-pr-already-exists.js');
|
|
let isPRWithLatestADFAlreadyAvailable = false;
|
|
let isPRWithLatestJSAlreadyAvailable = false;
|
|
if (hasNewADFVersion === 'true') {
|
|
isPRWithLatestADFAlreadyAvailable = await checkPRAlreadyExist({github, context, version: latestADFVersion});
|
|
console.log('isPRWithLatestADFAlreadyAvailable', isPRWithLatestADFAlreadyAvailable);
|
|
}
|
|
if (hasNewJSVersion === 'true') {
|
|
isPRWithLatestJSAlreadyAvailable = await checkPRAlreadyExist({github, context, version: latestADFVersion});
|
|
console.log('isPRWithLatestJSAlreadyAvailable', isPRWithLatestJSAlreadyAvailable);
|
|
}
|
|
if (isPRWithLatestADFAlreadyAvailable || isPRWithLatestJSAlreadyAvailable) {
|
|
console.log('Warning: Upstream PR already exist, stop the migration execution!');
|
|
core.setOutput('hasNewVersionWithoutPR', 'false');
|
|
} else {
|
|
core.setOutput('hasNewVersionWithoutPR', 'true');
|
|
}
|
|
migrate:
|
|
if: ${{ needs.upstream.outputs.hasNewVersionWithoutPR == 'true' }}
|
|
runs-on: ubuntu-latest
|
|
needs: upstream
|
|
steps:
|
|
- name: Generate app token
|
|
id: app-token
|
|
uses: actions/create-github-app-token@bcd2ba49218906704ab6c1aa796996da409d3eb1 # v3.2.0
|
|
with:
|
|
client-id: ${{ vars.GH_APP_ENGINEERING_CONTRIB_CLIENT_ID }}
|
|
private-key: ${{ secrets.GH_APP_ENGINEERING_CONTRIB_PRIVATE_KEY }}
|
|
permission-contents: write
|
|
permission-pull-requests: write
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v7
|
|
with:
|
|
fetch-depth: 1
|
|
- name: setup NPM
|
|
uses: actions/setup-node@v7
|
|
with:
|
|
node-version-file: '.nvmrc'
|
|
cache: 'npm'
|
|
- name: Migration
|
|
shell: bash
|
|
env:
|
|
IS_ADF_AFFECTED: ${{ needs.upstream.outputs.hasNewADFVersion }}
|
|
IS_JS_AFFECTED: ${{ needs.upstream.outputs.hasNewJSVersion }}
|
|
PACKAGE_VERSION_ADF: ${{ needs.upstream.outputs.latestADFVersion }}
|
|
PACKAGE_VERSION_JS: ${{ needs.upstream.outputs.latestJSVersion }}
|
|
run: |
|
|
migrateDependenciesADF() {
|
|
echo "Update ADF dependencies to: ${PACKAGE_VERSION_ADF}"
|
|
./scripts/update-version.sh -v ${PACKAGE_VERSION_ADF} -vj latest
|
|
echo "Migration ADF done"
|
|
}
|
|
migrateDependenciesJS() {
|
|
echo "Update JS dependencies to: ${PACKAGE_VERSION_JS}"
|
|
./scripts/update-version.sh -v latest -vj ${PACKAGE_VERSION_JS}
|
|
echo "Migration JS done"
|
|
}
|
|
migrateAllDependencies() {
|
|
echo "Update ADF dependencies to: ${PACKAGE_VERSION_ADF} and JS dependencies to: ${PACKAGE_VERSION_JS}"
|
|
./scripts/update-version.sh -v ${PACKAGE_VERSION_ADF} -vj ${PACKAGE_VERSION_JS}
|
|
echo "Migration done"
|
|
}
|
|
if [[ "$IS_ADF_AFFECTED" == "true" ]] && [[ "$IS_JS_AFFECTED" == "true" ]]; then
|
|
migrateAllDependencies
|
|
elif [[ "$IS_ADF_AFFECTED" == "true" ]]; then
|
|
migrateDependenciesADF
|
|
elif [[ "$IS_JS_AFFECTED" == "true" ]]; then
|
|
migrateDependenciesJS
|
|
fi
|
|
- name: Prepare PR title
|
|
id: pr-meta
|
|
if: ${{ needs.upstream.outputs.hasNewVersion == 'true' }}
|
|
env:
|
|
PACKAGE_VERSION_ADF: ${{ needs.upstream.outputs.latestADFVersion }}
|
|
PACKAGE_VERSION_JS: ${{ needs.upstream.outputs.latestJSVersion }}
|
|
run: |
|
|
if [[ "$PACKAGE_VERSION_ADF" == "next" || "$PACKAGE_VERSION_ADF" == "latest" ]]; then
|
|
title="GH Auto: Upstream dependencies ADF and JS-API using Tag:${PACKAGE_VERSION_ADF}"
|
|
else
|
|
title="GH Auto: Upstream dependencies ADF:${PACKAGE_VERSION_ADF} JS-API:${PACKAGE_VERSION_JS} using Tag:${PACKAGE_VERSION_ADF}"
|
|
fi
|
|
echo "title=$title" >> "$GITHUB_OUTPUT"
|
|
|
|
- name: Create a Pull request
|
|
if: ${{ needs.upstream.outputs.hasNewVersion == 'true' }}
|
|
uses: peter-evans/create-pull-request@5f6978faf089d4d20b00c7766989d076bb2fc7f1 # v8.1.1
|
|
with:
|
|
token: ${{ steps.app-token.outputs.token }}
|
|
base: develop
|
|
branch: upstream-dependencies
|
|
sign-commits: true
|
|
commit-message: "[ci:force][auto-commit] Update dependencies ADF:${{ needs.upstream.outputs.latestADFVersion }} JS:${{ needs.upstream.outputs.latestJSVersion }}"
|
|
title: ${{ steps.pr-meta.outputs.title }}
|
|
body: Automatic PR
|
|
add-paths: |
|
|
package.json
|
|
package-lock.json
|