Merge pull request #2511 from guardian/dependabot/npm_and_yarn/codema… #1605
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: CD | |
on: | |
push: | |
branches: | |
- main | |
workflow_dispatch: | |
jobs: | |
CD: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
id-token: write | |
pull-requests: write | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version-file: ".nvmrc" | |
cache: npm | |
- name: Install | |
run: npm ci | |
- name: Build | |
run: npm run build | |
- name: Lint | |
run: npm run lint | |
- name: Test | |
run: npm run test | |
- 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" | |
env: | |
# This action will raise a PR to edit package.json and package-lock.json. | |
# PRs raised by the default `secrets.GITHUB_TOKEN` will not trigger CI, so we need to provide a different token. | |
# This is a PAT for the guardian-ci user. | |
# See https://docs.github.com/en/actions/reference/events-that-trigger-workflows#triggering-new-workflows-using-a-personal-access-token | |
GITHUB_TOKEN: ${{ secrets.GU_GUARDIAN_CI_TOKEN }} | |
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | |
- name: Release docs | |
if: (github.ref == 'refs/heads/main') | |
run: | | |
git remote set-url origin https://git:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git | |
npm run release:docs |