-
Notifications
You must be signed in to change notification settings - Fork 6
56 lines (46 loc) · 1.52 KB
/
cd.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
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