diff --git a/.github/actions/npm-check-bundle/action.yml b/.github/actions/npm-check-bundle/action.yml index fbabf21036..edd2491b5b 100644 --- a/.github/actions/npm-check-bundle/action.yml +++ b/.github/actions/npm-check-bundle/action.yml @@ -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} \ No newline at end of file + 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} \ No newline at end of file diff --git a/.github/actions/travis-env-var-facade/action.yml b/.github/actions/travis-env-var-facade/action.yml index 902aac4969..22bd4b395a 100644 --- a/.github/actions/travis-env-var-facade/action.yml +++ b/.github/actions/travis-env-var-facade/action.yml @@ -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 \ No newline at end of file diff --git a/.github/actions/travis-event-type-load/action.yml b/.github/actions/travis-event-type-load/action.yml deleted file mode 100644 index 176f78cec2..0000000000 --- a/.github/actions/travis-event-type-load/action.yml +++ /dev/null @@ -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 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 64f7cf3e0d..d093df31fa 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -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 }}