Skip to content

Merge pull request #176 from guardian/an/public-node-package #10

Merge pull request #176 from guardian/an/public-node-package

Merge pull request #176 from guardian/an/public-node-package #10

Workflow file for this run

name: CD
on:
push:
branches:
- main
workflow_dispatch:
jobs:
CD:
runs-on: ubuntu-latest
permissions:
contents: write
id-token: write
pull-requests: write
defaults:
run:
working-directory: pan-domain-node
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v3
with:
node-version-file: "pan-domain-node/.nvmrc"
cache: npm
cache-dependency-path: "pan-domain-node/package-lock.json"
- name: Install
run: npm ci
- name: Build
run: npm run build
- name: Test
run: npm run test
- name: Use GitHub App Token
uses: actions/create-github-app-token@v1
id: app-token
with:
app-id: ${{ secrets.GU_CHANGESETS_APP_ID }}
private-key: ${{ secrets.GU_CHANGESETS_PRIVATE_KEY }}
- name: Set git user to Gu Changesets app
run: |
git config user.name "gu-changesets-release-pr[bot]"
git config user.email "gu-changesets-release-pr[bot]@users.noreply.github.com"
- name: Create Release Pull Request or Publish to npm
id: changesets
uses: changesets/action@v1
with:
publish: npx changeset publish
title: "🦋 Release package updates"
commit: "Bump package version"
cwd: "pan-domain-node"
setupGitUser: false
env:
GITHUB_TOKEN: ${{ steps.app-token.outputs.token }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}