54 lines (46 loc) · 1.54 KB
/
ci.yml
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
name: CI
on: [push, pull_request]
jobs:
ci:
name: CI
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@master
- name: Set up Node.js
uses: actions/setup-node@master
with:
node-version: 14
- name: Install dependencies
run: npm ci
- name: Lint
run: npm run lint
- name: Build
run: npm run dist
- name: Test
run: npm run test
- name: Create .npmrc
if: github.event_name == 'push'
run: |
cat << EOF > "$HOME/.npmrc"
//registry.npmjs.org/:_authToken=$NPM_TOKEN
EOF
env:
NPM_TOKEN: ${{ secrets.NPM_AUTH_TOKEN_SHARED }}
- name: Publish canary version
if: github.event_name == 'push'
run: |
echo "$( jq '.version = "0.0.0"' package.json )" > package.json
echo -e "---\n'@primer/components': patch\n---\n\nFake entry to force publishing" > .changeset/force-snapshot-release.md
npx changeset version --snapshot
npx changeset publish --tag canary
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Output canary version number
if: github.event_name == 'push'
run: |
name=$(jq -r .name package.json)
version=$(jq -r .version package.json)
npx action-status --context="Published $name" --state=success --description=$version --url "https://unpkg.com/$name@$version/"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}