Skip to content

Merge pull request #59 from contentful/chore/add-catalog-info #322

Merge pull request #59 from contentful/chore/add-catalog-info

Merge pull request #59 from contentful/chore/add-catalog-info #322

name: Node.js Package
on:
push:
branches: ['master']
pull_request:
types: [opened, synchronize]
branches: ['master']
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
jobs:
release:
name: Release
runs-on: ubuntu-latest
permissions:
contents: write # to be able to publish a GitHub release
issues: write # to be able to comment on released issues
pull-requests: write # to be able to comment on released pull requests
id-token: write # to enable use of OIDC for npm provenance
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: "Retrieve NPM Token"
id: vault
uses: hashicorp/vault-action@v2.4.3
with:
url: ${{ secrets.VAULT_URL }}
role: ${{ github.event.repository.name }}-github-action
method: jwt
path: github-actions
exportEnv: false
secrets: |
secret/data/github/github_packages_write GITHUB_PACKAGES_WRITE_TOKEN | GITHUB_PACKAGES_WRITE_TOKEN ;
github/token/integration-frontend-toolkit-semantic-release token | GITHUB_TOKEN ;
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: 18
registry-url: "https://npm.pkg.github.com"
scope: '@contentful'
always-auth: true
- name: "Create GH .npmrc"
shell: bash
run: |
echo -e "//npm.pkg.github.com/:_authToken=${GITHUB_TOKEN}\n@contentful:registry=https://npm.pkg.github.com\nalways-auth=true" > .npmrc
env:
GITHUB_TOKEN: ${{ steps.vault.outputs.GITHUB_PACKAGES_WRITE_TOKEN }}
- run: npm ci
- run: npm run build
- run: npm test
- run: |
npx semantic-release
env:
GITHUB_TOKEN: ${{ steps.vault.outputs.GITHUB_TOKEN }}
NPM_TOKEN: ${{ steps.vault.outputs.GITHUB_PACKAGES_WRITE_TOKEN }}