diff --git a/.contentful/vault-secrets.yml b/.contentful/vault-secrets.yml new file mode 100644 index 0000000..f8ce7a1 --- /dev/null +++ b/.contentful/vault-secrets.yml @@ -0,0 +1,7 @@ +version: 1 +services: + github-action: + policies: + - dependabot + - packages-read + - semantic-release diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS new file mode 100644 index 0000000..ea6af24 --- /dev/null +++ b/.github/CODEOWNERS @@ -0,0 +1,2 @@ +# team integrations owns all code in this repository by default +* @contentful/team-integrations \ No newline at end of file diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 0000000..d889732 --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,23 @@ +## Purpose + + + +## Description + + + +## Testing steps + + + +## Breaking Changes + + + +## Design, Documentation, and/or References + + + +## Deployment + + diff --git a/.github/workflows/release-package.yml b/.github/workflows/release-package.yml new file mode 100644 index 0000000..9b6edc7 --- /dev/null +++ b/.github/workflows/release-package.yml @@ -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 }} diff --git a/.nvmrc b/.nvmrc new file mode 100644 index 0000000..da80e40 --- /dev/null +++ b/.nvmrc @@ -0,0 +1 @@ +v19.6.0 \ No newline at end of file diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 0000000..af69f0d --- /dev/null +++ b/.prettierignore @@ -0,0 +1,4 @@ +node_modules/ +build/ +.coverage/ +.cache/ \ No newline at end of file diff --git a/catalog-info.yml b/catalog-info.yml new file mode 100644 index 0000000..a754b1d --- /dev/null +++ b/catalog-info.yml @@ -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 diff --git a/package.json b/package.json index 1a43ece..5a4b604 100644 --- a/package.json +++ b/package.json @@ -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" } }