AAE-12123 TAG_NPM fix

This commit is contained in:
Marco Carrozzo 2023-01-16 14:08:25 +01:00 committed by GitHub
parent a412b45300
commit 6138c16f42
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 46 additions and 46 deletions

View File

@ -1,19 +1,28 @@
name: 'Check NPM bundle'
description: 'check npm bundle'
outputs:
tag_sha:
description: "long sha of the tag"
value: ${{ steps.sha_out.outputs.tag_sha }}
inputs:
branch_name:
description: "override GITHUB_REF_NAME"
required: false
default: $GITHUB_REF_NAME
runs:
using: "composite"
steps:
- name: load "TRAVIS_EVENT_TYPE"
uses: ./.github/actions/travis-env-var-facade
with:
branch_name: ${{ inputs.branch_name }}
- name: check npm bundle
shell: bash
id: sha_out
run: |
ADF_VERSION=$(npm view @alfresco/adf-core@${TAG_NPM} version)
echo "check bundle on TAG_NPM='${TAG_NPM}' and ADF_VERSION='${ADF_VERSION}'"
./scripts/travis/build/npm-check-bundles.sh -v ${ADF_VERSION}
if [[ -z $TAG_NPM ]]; then
echo "TAG_NPM not set, aborting"
exit 1
fi
ADF_VERSION=$(npm view @alfresco/adf-core@${TAG_NPM} version)
echo "check bundle on TAG_NPM='${TAG_NPM}' and ADF_VERSION='${ADF_VERSION}'"
./scripts/travis/build/npm-check-bundles.sh -v ${ADF_VERSION}

View File

@ -7,12 +7,18 @@ inputs:
description: "override github.event_name"
required: false
default: ${{ github.event_name }}
branch_name:
description: "override GITHUB_REF_NAME"
required: false
default: $GITHUB_REF_NAME
runs:
using: "composite"
steps:
- name: Parse env global
shell: bash
run: |
echo "input branch_name='${{ inputs.branch_name }}'"
EVENT_TYPE=""
TRAVIS_PULL_REQUEST_BRANCH=""
TRAVIS_BRANCH=""
@ -30,16 +36,26 @@ runs:
elif [[ "${{ inputs.event_name }}" =~ $REGEX ]]; then
EVENT_TYPE="api";
fi
if [[ $GITHUB_REF_NAME == "master" ]]; then
echo "Set up TAG_NPM to latest on master branch"
TAG_NPM="latest"
fi
if [[ $GITHUB_REF_NAME == "develop" ]]; then
echo "Set up TAG_NPM to alpha on develop branch"
TAG_NPM="alpha"
fi
echo "TAG_NPM=${TAG_NPM}" >> $GITHUB_ENV
echo "TRAVIS_EVENT_TYPE=${EVENT_TYPE}" >> $GITHUB_ENV
echo "TRAVIS_PULL_REQUEST_BRANCH=${TRAVIS_PULL_REQUEST_BRANCH}" >> $GITHUB_ENV
echo "TRAVIS_BRANCH=${TRAVIS_BRANCH}" >> $GITHUB_ENV
- name: set TAG_NPM
shell: bash
run: |
VERSION_IN_PACKAGE_JSON=$(node -p "require('./package.json')".version)
echo "version in package.json=${VERSION_IN_PACKAGE_JSON}"
if [[ ${{ inputs.branch_name }} =~ ^master(-patch.*)?$ ]]; then
# Pre-release versions
if [[ $VERSION_IN_PACKAGE_JSON =~ ^[0-9]*\.[0-9]*\.[0-9]*-A\.[0-9]*$ ]];
then
TAG_NPM=next
# Stable major versions
else
TAG_NPM=latest
fi
fi
if [[ ${{ inputs.branch_name }} =~ ^develop(-patch.*)?$ ]]; then
TAG_NPM=alpha
fi
echo "TAG_NPM=${TAG_NPM}" >> $GITHUB_ENV

View File

@ -1,28 +0,0 @@
# TRAVIS_EVENT_TYPE= Indicates how the build was triggered. One of push, pull_request, api, cron
name: "travis-event-type-env-var"
description: "Mimic loading of a TRAVIS_EVENT_TYPE env var"
inputs:
event_name:
description: "override github.event_name"
required: false
default: ${{ github.event_name }}
runs:
using: "composite"
steps:
- name: Parse env global
run: |
EVENT_TYPE=""
REGEX="(repository|workflow)_dispatch"
if [[ "${{ inputs.event_name }}" == "schedule" ]]; then
EVENT_TYPE="cron";
elif [[ "${{ inputs.event_name }}" == "pull_request" ]]; then
EVENT_TYPE="pull_request";
elif [[ "${{ inputs.event_name }}" == "push" ]]; then
EVENT_TYPE="push";
elif [[ "${{ inputs.event_name }}" =~ $REGEX ]]; then
EVENT_TYPE="api";
fi
echo "TRAVIS_EVENT_TYPE=${EVENT_TYPE}" >> $GITHUB_ENV
echo "exporting TRAVIS_EVENT_TYPE=${EVENT_TYPE}"
shell: bash

View File

@ -79,6 +79,9 @@ jobs:
with:
fetch-depth: 0
- uses: ./.github/actions/setup
with:
enable-cache: false
enable-node-modules-cache: false
- name: install
run: |
npm ci
@ -162,7 +165,7 @@ jobs:
run: |
set -u;
./scripts/travis/build/bumpversion.sh
nx affected:build $NX_CALCULATION_FLAGS --prod --exclude="demoshell"
nx affected:build $NX_CALCULATION_FLAGS --prod --exclude="demoshell" --skip-nx-cache
nx affected $NX_CALCULATION_FLAGS --target=pretheme
- name: release libraries
run: ./scripts/travis/release/release-npm.sh ${{ steps.set-dryrun.outputs.dryrun }}