Skip to content

Commit 68d714e

Browse files
committed
fix(deps): updated deps and added semver workflow
1 parent a5a21e7 commit 68d714e

File tree

6 files changed

+17830
-11223
lines changed

6 files changed

+17830
-11223
lines changed

.github/workflows/main.yml

+77-19
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,85 @@
1-
name: CI
1+
name: CI & Release
22
on:
3-
- push
4-
- pull_request
3+
# Build on pushes to release branches
4+
push:
5+
branches: ["main"]
6+
# Build on pull requests targeting release branches
7+
pull_request:
8+
branches: ["main"]
9+
workflow_dispatch:
10+
inputs:
11+
release:
12+
description: Release new version
13+
required: true
14+
default: false
15+
type: boolean
16+
517
jobs:
6-
test:
7-
runs-on: ${{ matrix.platform }}
8-
name: Node.js ${{ matrix.node-version }} / ${{ matrix.platform }}
9-
strategy:
10-
fail-fast: false
11-
matrix:
12-
platform: [ubuntu-latest, macos-latest, windows-latest]
13-
node-version:
14-
- 16
18+
log-the-inputs:
19+
name: Log inputs
20+
runs-on: ubuntu-latest
21+
steps:
22+
- run: |
23+
echo "Inputs: $INPUTS"
24+
env:
25+
INPUTS: ${{ toJSON(inputs) }}
26+
27+
build:
28+
name: Lint & Build
29+
runs-on: ubuntu-latest
1530
steps:
1631
- name: Set git to use LF
1732
run: |
1833
git config --global core.autocrlf false
1934
git config --global core.eol lf
20-
- uses: actions/checkout@v2
21-
- uses: actions/setup-node@v1
35+
- uses: actions/checkout@v3
36+
- uses: actions/setup-node@v3
37+
with:
38+
node-version: lts/*
39+
cache: npm
40+
- run: npm ci
41+
- run: npm run lint --if-present
42+
- run: npm run prepublishOnly
43+
44+
test:
45+
name: Test
46+
needs: build
47+
strategy:
48+
matrix:
49+
os: [ macos-latest, ubuntu-latest ]
50+
node: [ lts/*, current ]
51+
runs-on: ${{ matrix.os }}
52+
steps:
53+
- uses: actions/checkout@v3
54+
- uses: actions/setup-node@v3
55+
with:
56+
node-version: ${{ matrix.node }}
57+
cache: npm
58+
- run: npm ci
59+
- run: npm test --if-present
60+
61+
release:
62+
name: Semantic release
63+
needs: test
64+
runs-on: ubuntu-latest
65+
# only run if opt-in during workflow_dispatch
66+
if: inputs.release == true
67+
steps:
68+
- uses: actions/checkout@v3
69+
with:
70+
# Need to fetch entire commit history to
71+
# analyze every commit since last release
72+
fetch-depth: 0
73+
- uses: actions/setup-node@v3
2274
with:
23-
node-version: ${{ matrix.node-version }}
24-
- run: npm install
25-
- run: npm run lint
26-
- run: npm run build
27-
#- run: npm test
75+
node-version: lts/*
76+
cache: npm
77+
- run: npm ci
78+
# Branches that will release new versions are defined in .releaserc.json
79+
- run: npx semantic-release --dry-run
80+
# Don't allow interrupting the release step if the job is cancelled, as it can lead to an inconsistent state
81+
# e.g. git tags were pushed but it exited before `npm publish`
82+
if: always()
83+
env:
84+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
85+
NPM_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }}

.npmrc

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
legacy-peer-deps=true

.releaserc.json

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"extends": "@sanity/semantic-release-preset",
3+
"branches": ["main"]
4+
}

0 commit comments

Comments
 (0)