Skip to content

Commit

Permalink
Add initial publish config
Browse files Browse the repository at this point in the history
  • Loading branch information
Matt Gordon committed Apr 23, 2024
1 parent 80107a9 commit 84d4520
Show file tree
Hide file tree
Showing 8 changed files with 122 additions and 0 deletions.
7 changes: 7 additions & 0 deletions .contentful/vault-secrets.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
version: 1
services:
github-action:
policies:
- dependabot
- packages-read
- semantic-release
2 changes: 2 additions & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# team integrations owns all code in this repository by default
* @contentful/team-integrations
23 changes: 23 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
## Purpose

<!-- Why are we introducing this component? What is the story/background for it? -->

## Description

<!--What does this component do? Where is the component expected to be used outside of this component library? -->

## Testing steps

<!-- Where can the user find this component to test its functionality? -->

## Breaking Changes

<!-- Are there any changes to be aware of that would break current production build? -->

## Design, Documentation, and/or References

<!-- What original designs are associated with this component? Where can we get more insights about this change? (Tickets, wiki pages or links to other places/docs -- no private/internal links please) -->

## Deployment

<!-- (Optional) Are there any deployment-related tasks, concerns or risks we should be mindful of? -->
65 changes: 65 additions & 0 deletions .github/workflows/release-package.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: Node.js Package

on:
push:
branches: ['main']
pull_request:
types: [opened, synchronize]
branches: ['main']

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 }}
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
v19.6.0
4 changes: 4 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
node_modules/
build/
.coverage/
.cache/
11 changes: 11 additions & 0 deletions catalog-info.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
apiVersion: backstage.io/v1alpha1
kind: Component
metadata:
name: vercel-toolkit
annotations:
github.com/project-slug: contentful/vercel-toolkit

spec:
type: library
lifecycle: production
owner: group:team-integrations
9 changes: 9 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,14 @@
"typescript": "^5.2.2",
"vite": "^5.2.0",
"vite-plugin-dts": "^3.9.0"
},
"release": {
"branches": [
"main"
]
},
"publishConfig": {
"registry": "https://npm.pkg.github.com",
"access": "public"
}
}

0 comments on commit 84d4520

Please sign in to comment.