Try to fix publish action #248
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: "Test and publish on main" | |
on: | |
push: | |
branches: | |
- "main" | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Setup Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 16 | |
cache: 'npm' | |
cache-dependency-path: '**/package-lock.json' | |
- name: Cache Cypress | |
uses: actions/cache@v3 | |
with: | |
path: ~/.cache/Cypress | |
key: ${{ runner.os }}-cypress-${{ hashFiles('cypress.json') }} | |
- name: Install dependencies | |
run: npm ci | |
env: | |
CI: true | |
- name: Run Linter | |
run: npm run lint | |
- name: Run Tests | |
run: npm test | |
env: | |
CYPRESS_CACHE_FOLDER: '~/.cache/Cypress' | |
publish-npm: | |
runs-on: ubuntu-latest | |
needs: test | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Setup Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 16 | |
registry-url: https://registry.npmjs.org | |
cache: 'npm' | |
cache-dependency-path: '**/package-lock.json' | |
- name: Cache Cypress | |
uses: actions/cache@v3 | |
with: | |
path: ~/.cache/Cypress | |
key: ${{ runner.os }}-cypress-${{ hashFiles('cypress.json') }} | |
- name: Verify NPM Registry and Package Name | |
run: | | |
echo "Registry URL: $(npm config get registry)" | |
echo "Package Name: $(node -p "require('./package.json').name")" | |
- name: Automated Version Bump | |
uses: phips28/[email protected] | |
with: | |
tag-prefix: 'd4-' | |
- name: Install dependencies | |
run: npm ci | |
env: | |
CI: true | |
- name: Publish to NPM registry | |
run: npm publish --access public | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }} |