This repository has been archived by the owner on Nov 5, 2024. It is now read-only.
Merge pull request #189 from navikt/dependabot/npm_and_yarn/demo/ejs-… #676
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, build, publish | |
on: | |
- push | |
- workflow_dispatch | |
jobs: | |
component: | |
runs-on: ubuntu-latest | |
permissions: | |
packages: write | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: '16' | |
registry-url: 'https://registry.npmjs.org' | |
cache: 'npm' | |
cache-dependency-path: component/package-lock.json | |
- name: install dependencies | |
run: | | |
cd component | |
npm ci | |
- name: build | |
run: | | |
cd component | |
npm run build | |
- name: test | |
run: | | |
cd component | |
npm test | |
- if: github.ref == 'refs/heads/main' | |
name: publish | |
run: | | |
cd component | |
if jq --null-input --exit-status \ | |
--argjson local "$(jq .version package.json)" \ | |
--argjson published "$(npm view --json @navikt/arbeidsgiver-notifikasjon-widget versions)" \ | |
'$published | map(. == $local) | any' | |
then | |
echo "Version already published. Nothing to do." | |
else | |
npm publish --access public | |
fi | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NODE_AUTH_TOKEN }} | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: '16' | |
registry-url: 'https://npm.pkg.github.com' | |
- if: github.ref == 'refs/heads/main' | |
name: publish on github | |
run: | | |
cd component | |
if jq --null-input --exit-status \ | |
--argjson local "$(jq .version package.json)" \ | |
--argjson published "$(npm view --json @navikt/arbeidsgiver-notifikasjon-widget versions)" \ | |
'$published | map(. == $local) | any' | |
then | |
echo "Version already published. Nothing to do." | |
else | |
npm publish --access public | |
fi | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
brukerapi-mock: | |
runs-on: ubuntu-latest | |
permissions: | |
packages: write | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-node@v2 | |
with: | |
node-version: '16' | |
registry-url: 'https://registry.npmjs.org' | |
- name: build | |
run: | | |
cd brukerapi-mock | |
npm run build | |
- if: github.ref == 'refs/heads/main' | |
name: publish | |
run: | | |
cd brukerapi-mock | |
if jq --null-input --exit-status \ | |
--argjson local "$(jq .version package.json)" \ | |
--argjson published "$(npm view --json @navikt/arbeidsgiver-notifikasjoner-brukerapi-mock versions)" \ | |
'$published | map(. == $local) | any' | |
then | |
echo "Version already published. Nothing to do." | |
else | |
npm publish --access public | |
fi | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NODE_AUTH_TOKEN }} | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: '16' | |
registry-url: 'https://npm.pkg.github.com' | |
- if: github.ref == 'refs/heads/main' | |
name: publish on github | |
run: | | |
cd brukerapi-mock | |
if jq --null-input --exit-status \ | |
--argjson local "$(jq .version package.json)" \ | |
--argjson published "$(npm view --json @navikt/arbeidsgiver-notifikasjoner-brukerapi-mock versions)" \ | |
'$published | map(. == $local) | any' | |
then | |
echo "Version already published. Nothing to do." | |
else | |
npm publish --access public | |
fi | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |