From 419d49d2920fbdf4bf88e8efc3421f7c37ec209b Mon Sep 17 00:00:00 2001 From: Keshav Varadachari Date: Tue, 15 Mar 2022 14:22:13 -0400 Subject: [PATCH] use outputs to get core pkg version (#37875) --- .github/workflows/publish-npm-packages.yml | 6 +++++- build-system/npm-publish/write-package-files.js | 8 +++----- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/.github/workflows/publish-npm-packages.yml b/.github/workflows/publish-npm-packages.yml index 4fb63d127a54..a2d949b5f22f 100644 --- a/.github/workflows/publish-npm-packages.yml +++ b/.github/workflows/publish-npm-packages.yml @@ -53,6 +53,8 @@ jobs: environment: bento_publishing needs: setup runs-on: ubuntu-latest + outputs: + core-version: ${{ steps.build-core.outputs.core-version }} steps: - uses: actions/checkout@v2 with: @@ -67,12 +69,14 @@ jobs: wget -q "${{ env.SCRIPTS_REPO }}/${{ env.SCRIPTS_DIR }}/get-core-version.js" -O ${{ env.SCRIPTS_DIR }}/get-core-version.js wget -q "${{ env.SCRIPTS_REPO }}/${{ env.SCRIPTS_DIR }}/build-npm-binaries.js" -O ${{ env.SCRIPTS_DIR }}/build-npm-binaries.js - name: Build package + id: build-core run: | npm ci node ${{ env.SCRIPTS_DIR }}/build-npm-binaries.js CORE_VERSION=$(node ${{ env.SCRIPTS_DIR }}/get-core-version.js ${{ github.event.inputs.amp-version }}) cd ./src/bento/core npm version $CORE_VERSION --git-tag-version=false --allow-same-version=true + echo "::set-output name=core-version::${CORE_VERSION}" - name: Publish package for Nightly releases if: github.event.inputs.tag != 'latest' run: | @@ -118,7 +122,7 @@ jobs: run: | npm ci node ${{ env.SCRIPTS_DIR }}/build-npm-binaries.js ${{ matrix.extension }} - node ${{ env.SCRIPTS_DIR }}/write-package-files.js ${{ matrix.extension }} ${{ github.event.inputs.amp-version }} ${{ matrix.version }} + node ${{ env.SCRIPTS_DIR }}/write-package-files.js ${{ matrix.extension }} ${{ github.event.inputs.amp-version }} ${{ matrix.version }} ${{ needs.publish-core.outputs.core-version }} - name: Publish package for Nightly releases if: github.event.inputs.tag != 'latest' run: | diff --git a/build-system/npm-publish/write-package-files.js b/build-system/npm-publish/write-package-files.js index 39633bf1d69b..f4573422c65f 100644 --- a/build-system/npm-publish/write-package-files.js +++ b/build-system/npm-publish/write-package-files.js @@ -3,7 +3,8 @@ * Creates npm package files for a given component and AMP version. */ -const [extension, ampVersion, extensionVersion] = process.argv.slice(2); +const [extension, ampVersion, extensionVersion, corePkgVersion] = + process.argv.slice(2); const fastGlob = require('fast-glob'); const marked = require('marked'); const path = require('path'); @@ -14,10 +15,7 @@ const {getPackageDir, getSemver} = require('./utils'); const {log} = require('../common/logging'); const {stat, writeFile} = require('fs/promises'); const {valid} = require('semver'); -const { - name: corePkgName, - version: corePkgVersion, -} = require('../../src/bento/core/package.json'); +const {name: corePkgName} = require('../../src/bento/core/package.json'); const packageName = getNameWithoutComponentPrefix(extension);