bump node version

This commit is contained in:
Rodrigo Fernandes 2024-12-23 22:52:07 +00:00
parent 2f8c477f66
commit 2f4f41a31d
No known key found for this signature in database

View file

@ -52,7 +52,7 @@ jobs:
needs: [version] needs: [version]
strategy: strategy:
matrix: matrix:
node-version: [16.x, 18.x, 20.x] node-version: [16.x, 18.x, 20.x, 22.x]
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
with: with:
@ -64,8 +64,8 @@ jobs:
cache: 'npm' cache: 'npm'
- name: Log environment setup - name: Log environment setup
run: | run: |
node -v node -v
npm -v npm -v
- name: Install dependencies - name: Install dependencies
run: npm install run: npm install
- name: Build templates - name: Build templates
@ -89,57 +89,57 @@ jobs:
run: echo "version=$(cat next-version.txt)" >> $GITHUB_ENV run: echo "version=$(cat next-version.txt)" >> $GITHUB_ENV
- name: Configure Git - name: Configure Git
run: | run: |
git config user.email "gh-actions@users.noreply.github.com" git config user.email "gh-actions@users.noreply.github.com"
git config user.name "GitHub Actions" git config user.name "GitHub Actions"
- name: Tag commit - name: Tag commit
uses: tvdias/github-tagger@v0.0.1 uses: tvdias/github-tagger@v0.0.1
with: with:
repo-token: "${{ secrets.GITHUB_TOKEN }}" repo-token: '${{ secrets.GITHUB_TOKEN }}'
tag: "${{ env.version }}" tag: '${{ env.version }}'
- name: Install dependencies - name: Install dependencies
run: npm install run: npm install
- uses: actions/setup-node@v3 - uses: actions/setup-node@v3
with: with:
registry-url: 'https://registry.npmjs.org' registry-url: 'https://registry.npmjs.org'
node-version: '18.x' node-version: '22.x'
- name: Configure NPM version - name: Configure NPM version
env: env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
run: | run: |
rm -f .npmrc rm -f .npmrc
touch .npmrc touch .npmrc
echo "//registry.npmjs.org/:_authToken=${NODE_AUTH_TOKEN}" >> .npmrc echo "//registry.npmjs.org/:_authToken=${NODE_AUTH_TOKEN}" >> .npmrc
echo "registry=https://registry.npmjs.org/" >> .npmrc echo "registry=https://registry.npmjs.org/" >> .npmrc
echo "access=public" >> .npmrc echo "access=public" >> .npmrc
echo "save-exact=true" >> .npmrc echo "save-exact=true" >> .npmrc
- name: Version package - name: Version package
run: | run: |
# Update version in packages to publish # Update version in packages to publish
npm version $(cat next-version.txt) -m "Release version %s" npm version $(cat next-version.txt) -m "Release version %s"
- name: Publish to NPM - name: Publish to NPM
run: npm publish --tag $(cat publish-tag.txt) run: npm publish --tag $(cat publish-tag.txt)
- uses: actions/setup-node@v3 - uses: actions/setup-node@v3
with: with:
node-version: '18.x' node-version: '22.x'
registry-url: 'https://npm.pkg.github.com' registry-url: 'https://npm.pkg.github.com'
- name: Configure NPM version - name: Configure NPM version
env: env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: | run: |
rm -f .npmrc rm -f .npmrc
touch .npmrc touch .npmrc
echo "//npm.pkg.github.com/:_authToken=${NODE_AUTH_TOKEN}" >> .npmrc echo "//npm.pkg.github.com/:_authToken=${NODE_AUTH_TOKEN}" >> .npmrc
echo "@rtfpessoa:registry=https://npm.pkg.github.com/" >> .npmrc echo "@rtfpessoa:registry=https://npm.pkg.github.com/" >> .npmrc
echo "access=public" >> .npmrc echo "access=public" >> .npmrc
echo "save-exact=true" >> .npmrc echo "save-exact=true" >> .npmrc
- name: Publish to GPR - name: Publish to GPR
run: | run: |
# HACK: Override npm package name to be able to publish in GitHub # HACK: Override npm package name to be able to publish in GitHub
sed -i 's/^ "name":.*/ "name": "@rtfpessoa\/diff2html",/g' package.json sed -i 's/^ "name":.*/ "name": "@rtfpessoa\/diff2html",/g' package.json
echo "Going to publish version $(cat next-version.txt) to GitHub" echo "Going to publish version $(cat next-version.txt) to GitHub"
npm publish --tag $(cat publish-tag.txt) npm publish --tag $(cat publish-tag.txt)
# HACK: Restore npm package name # HACK: Restore npm package name
sed -i 's/^ "name":.*/ "name": "diff2html",/g' package.json sed -i 's/^ "name":.*/ "name": "diff2html",/g' package.json
- name: Upload docs - name: Upload docs
uses: actions/upload-artifact@v3 uses: actions/upload-artifact@v3
with: with: