Skip to content

Commit

Permalink
chore: update release-previous-stable
Browse files Browse the repository at this point in the history
  • Loading branch information
DarkGenius committed Feb 19, 2024
1 parent 8a2b773 commit 67de77a
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions .github/workflows/release-previous-stable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,16 @@ 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 "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) {
Expand All @@ -53,12 +57,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
Expand Down

0 comments on commit 67de77a

Please sign in to comment.