Skip to content

Commit

Permalink
chore: added job to detect latest major version on npm
Browse files Browse the repository at this point in the history
  • Loading branch information
lquixada committed Jul 1, 2023
1 parent 83f6092 commit e597639
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,18 @@ jobs:
env:
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}

major:
runs-on: ubuntu-latest
outputs:
latest: ${{ steps.npm-major.outputs.version }}
steps:
- id: npm-major
run: echo version=$(npm view cross-fetch@latest version | cut -d. -f1) >> "$GITHUB_OUTPUT"

publish:
name: Publish to NPM registry
runs-on: ubuntu-latest
needs: [checks, security]
needs: [checks, security, major]
steps:
- uses: actions/checkout@v3
# Setup .npmrc file to publish to npm
Expand All @@ -64,6 +72,9 @@ jobs:
path: ~/.npm # this is cache where npm installs from before going out to the network
key: ${{ runner.os }}-node-${{ hashFiles('**/package.json') }}
- run: npm install --prefer-offline
- run: echo "$LATEST"
env:
LATEST: ${{needs.major.outputs.latest}}
- if: ${{ !contains(github.ref_name, '-test.') }}
run: npm publish --tag latest-v4.x
env:
Expand Down

0 comments on commit e597639

Please sign in to comment.