-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: added --ecosystem-preset to init
- Loading branch information
Showing
13 changed files
with
235 additions
and
23 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,7 @@ | ||
{ | ||
"extends": "@sanity/semantic-release-preset", | ||
"branches": ["main"] | ||
"branches": [ | ||
"main", | ||
{"name": "ecosystem-preset", "channel": "ecosystem-preset", "prerelease": true} | ||
] | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
name: CI & Release | ||
on: | ||
# Build on pushes to release branches | ||
push: | ||
branches: [main] | ||
# Build on pull requests targeting release branches | ||
pull_request: | ||
branches: [main] | ||
workflow_dispatch: | ||
inputs: | ||
release: | ||
description: Release new version | ||
required: true | ||
default: false | ||
type: boolean | ||
|
||
jobs: | ||
log-the-inputs: | ||
name: Log inputs | ||
runs-on: ubuntu-latest | ||
steps: | ||
- run: | | ||
echo "Inputs: $INPUTS" | ||
env: | ||
INPUTS: ${{ toJSON(inputs) }} | ||
build: | ||
name: Lint & Build | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Set git to use LF | ||
run: | | ||
git config --global core.autocrlf false | ||
git config --global core.eol lf | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-node@v3 | ||
with: | ||
node-version: lts/* | ||
cache: npm | ||
- run: npm ci | ||
- run: npm run lint --if-present | ||
- run: npm run prepublishOnly | ||
|
||
test: | ||
name: Test | ||
needs: build | ||
strategy: | ||
matrix: | ||
os: [ macos-latest, ubuntu-latest ] | ||
node: [ lts/*, current ] | ||
runs-on: ${{ matrix.os }} | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-node@v3 | ||
with: | ||
node-version: ${{ matrix.node }} | ||
cache: npm | ||
- run: npm ci | ||
- run: npm test --if-present | ||
|
||
release: | ||
name: Semantic release | ||
needs: test | ||
runs-on: ubuntu-latest | ||
# only run if opt-in during workflow_dispatch | ||
if: inputs.release == true | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
# Need to fetch entire commit history to | ||
# analyze every commit since last release | ||
fetch-depth: 0 | ||
- uses: actions/setup-node@v3 | ||
with: | ||
node-version: lts/* | ||
cache: npm | ||
- run: npm ci | ||
# Branches that will release new versions are defined in .releaserc.json | ||
- run: npx semantic-release | ||
# Don't allow interrupting the release step if the job is cancelled, as it can lead to an inconsistent state | ||
# e.g. git tags were pushed but it exited before `npm publish` | ||
if: always() | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
NPM_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#!/bin/sh | ||
. "$(dirname "$0")/_/husky.sh" | ||
|
||
npx --no -- commitlint --edit "" |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#!/bin/sh | ||
. "$(dirname "$0")/_/husky.sh" | ||
|
||
npx lint-staged |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"extends": "@sanity/semantic-release-preset", | ||
"branches": ["main"] | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
module.exports = { | ||
extends: ['@commitlint/config-conventional'], | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"$schema": "https://docs.renovatebot.com/renovate-schema.json", | ||
"extends": [ | ||
"github>sanity-io/renovate-presets//ecosystem/auto", | ||
"github>sanity-io/renovate-presets//ecosystem/studio-v3" | ||
] | ||
} |
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import {FromTo} from '../actions/splat' | ||
import {resolveLatestVersions} from '../npm/resolveLatestVersions' | ||
|
||
export function ecosystemPresetFiles(): FromTo[] { | ||
return [ | ||
{ | ||
from: ['ecosystem', '.github', 'workflows', 'main.yml'], | ||
to: ['.github', 'workflows', 'main.yml'], | ||
}, | ||
{ | ||
from: ['ecosystem', '.husky', 'commit-msg'], | ||
to: ['.husky', 'commit-msg'], | ||
}, | ||
{ | ||
from: ['ecosystem', '.husky', 'pre-commit'], | ||
to: ['.husky', 'pre-commit'], | ||
}, | ||
{from: ['ecosystem', '.releaserc.json'], to: '.releaserc.json'}, | ||
{from: ['ecosystem', 'commitlint.config.js'], to: 'commitlint.config.js'}, | ||
{from: ['ecosystem', 'renovate.json'], to: 'renovate.json'}, | ||
] | ||
} | ||
|
||
export async function ecosystemDevDependencies(): Promise<Record<string, string>> { | ||
return resolveLatestVersions([ | ||
'@commitlint/cli', | ||
'@commitlint/config-conventional', | ||
'@sanity/semantic-release-preset', | ||
'husky', | ||
'lint-staged', | ||
]) | ||
} |
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
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