diff --git a/.github/workflows/release-previous-stable.yml b/.github/workflows/release-previous-stable.yml index 230948e..8a65b88 100644 --- a/.github/workflows/release-previous-stable.yml +++ b/.github/workflows/release-previous-stable.yml @@ -31,12 +31,17 @@ jobs: shell: bash - run: npm test shell: bash - - run: npm i -D @actions/core - shell: bash - - name: Bump and commit version + - name: Get package versions + id: npm_versions run: | - node -e 'const core = require("@actions/core"); - const versions = JSON.parse(process.argv[1]).reverse(); + npm_view_output=$(npm view . versions --json | tr -d '\n ') + echo ${npm_view_output} + echo "name=npm_versions::${npm_view_output}" >> $GITHUB_OUTPUT + - name: Bump and commit version + uses: actions/github-script@v7 + with: + script: | + const versions = JSON.parse(`${{ steps.npm_versions.outputs.npm_versions }}`).reverse(); const currMajor = versions[0].split(".")[0]; const prevVersion = versions.find(v => !v.startsWith(`${currMajor}.`)); if (!prevVersion) { @@ -53,12 +58,13 @@ jobs: versionParts[2] = `${Number(versionParts[2])+1}`; } const newVersion = versionParts.join("."); + core.info(`New version: ${newVersion}`); try { core.exportVariable('PUBLISH_VERSION', newVersion); core.exportVariable('PUBLISH_VERSION_MAJOR', versionParts[0]); } catch (error) { core.setFailed(error.message); - }' $(npm view . versions --json | tr -d '\n ') + } env: VERSION_TYPE: ${{ github.event.inputs.version_type }} - name: Set version