Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/chore/upgrade-v3'
Browse files Browse the repository at this point in the history
# Conflicts:
#	.github/workflows/main.yml
#	.gitignore
  • Loading branch information
snorrees committed Nov 14, 2022
2 parents 59bd8f1 + 2e5b8e7 commit 2e9f5f9
Show file tree
Hide file tree
Showing 27 changed files with 24,675 additions and 22,334 deletions.
13 changes: 13 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
; editorconfig.org
root = true
charset= utf8

[*]
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
indent_style = space
indent_size = 2

[*.md]
trim_trailing_whitespace = false
6 changes: 6 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
.eslintrc.js
commitlint.config.js
lib
lint-staged.config.js
package.config.ts
*.js
14 changes: 14 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"root": true,
"env": {
"node": true,
"browser": true
},
"extends": [
"sanity",
"sanity/typescript",
"sanity/react",
"plugin:react-hooks/recommended",
"plugin:prettier/recommended"
]
}
105 changes: 76 additions & 29 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,19 +1,42 @@
---
name: CI & Release

# Workflow name based on selected inputs. Fallback to default Github naming when expression evaluates to empty string
run-name: >-
${{
inputs.release && inputs.test && 'Build ➤ Test ➤ Publish to NPM' ||
inputs.release && !inputs.test && 'Build ➤ Skip Tests ➤ Publish to NPM' ||
github.event_name == 'workflow_dispatch' && inputs.test && 'Build ➤ Test' ||
github.event_name == 'workflow_dispatch' && !inputs.test && 'Build ➤ Skip Tests' ||
''
}}
on:
# Build on pushes to release branches
push:
branches: [main, v3]
# Build on pull requests targeting release branches
# Build on pushes branches that have a PR (including drafts)
pull_request:
branches: [main, v3]
# Build on commits pushed to branches without a PR if it's in the allowlist
push:
branches: [main,v3]
# https://docs.github.com/en/actions/managing-workflow-runs/manually-running-a-workflow
workflow_dispatch:
inputs:
test:
description: Run tests
required: true
default: true
type: boolean
release:
description: Release new version
required: true
default: false
type: boolean

concurrency:
# On PRs builds will cancel if new pushes happen before the CI completes, as it defines `github.head_ref` and gives it the name of the branch the PR wants to merge into
# Otherwise `github.run_id` ensures that you can quickly merge a queue of PRs without causing tests to auto cancel on any of the commits pushed to main.
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

jobs:
log-the-inputs:
name: Log inputs
Expand All @@ -25,61 +48,85 @@ jobs:
INPUTS: ${{ toJSON(inputs) }}
build:
name: Lint & Build
runs-on: ubuntu-latest
name: Lint & Build
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
- uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # tag=v3
- uses: actions/setup-node@8c91899e586c5b171469028077307d293428b516 # tag=v3
with:
node-version: lts/*
cache: npm
node-version: lts/*
- run: npm ci
# Linting can be skipped
- run: npm run lint --if-present
- run: npm run prepublishOnly
if: github.event.inputs.test != 'false'
# But not the build script, as semantic-release will crash if this command fails so it makes sense to test it early
- run: npm run prepublishOnly --if-present

test:
name: Test
needs: build
# The test matrix can be skipped, in case a new release needs to be fast-tracked and tests are already passing on main
if: github.event.inputs.test != 'false'
runs-on: ${{ matrix.os }}
name: Node.js ${{ matrix.node }} / ${{ matrix.os }}
strategy:
# A test failing on windows doesn't mean it'll fail on macos. It's useful to let all tests run to its completion to get the full picture
fail-fast: false
matrix:
os: [ macos-latest, ubuntu-latest ]
node: [ lts/*, current ]
runs-on: ${{ matrix.os }}
# Run the testing suite on each major OS with the latest LTS release of Node.js
os: [macos-latest, ubuntu-latest, windows-latest]
node: [lts/*]
# It makes sense to also test the oldest, and latest, versions of Node.js, on ubuntu-only since it's the fastest CI runner
include:
- os: ubuntu-latest
# Test the oldest LTS release of Node that's still receiving bugfixes and security patches, versions older than that have reached End-of-Life
node: lts/-2
- os: ubuntu-latest
# Test the actively developed version that will become the latest LTS release next October
node: current
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
# It's only necessary to do this for windows, as mac and ubuntu are sane OS's that already use LF
- name: Set git to use LF
if: matrix.os == 'windows-latest'
run: |
git config --global core.autocrlf false
git config --global core.eol lf
- uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # tag=v3
- uses: actions/setup-node@8c91899e586c5b171469028077307d293428b516 # tag=v3
with:
node-version: ${{ matrix.node }}
cache: npm
node-version: ${{ matrix.node }}
- run: npm ci
- run: npm test --if-present

release:
name: Semantic release
needs: test
runs-on: ubuntu-latest
needs: [build, test]
# only run if opt-in during workflow_dispatch
if: inputs.release == true
if: always() && github.event.inputs.release == 'true' && needs.build.result != 'failure' && needs.test.result != 'failure' && needs.test.result != 'cancelled'
runs-on: ubuntu-latest
name: Semantic release
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # tag=v3
with:
# Need to fetch entire commit history to
# analyze every commit since last release
fetch-depth: 0
- uses: actions/setup-node@v3
- uses: actions/setup-node@8c91899e586c5b171469028077307d293428b516 # tag=v3
with:
node-version: lts/*
cache: npm
node-version: lts/*
- run: npm ci
# Branches that will release new versions are defined in .releaserc.json
- run: npx semantic-release --dry-run
- 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 }}
# Re-run semantic release with rich logs if it failed to publish for easier debugging
- run: npx semantic-release --dry-run --debug
if: failure()
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }}
61 changes: 56 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,10 +1,61 @@
# Logs
logs
*.log
.DS_Store
npm-debug.log*

# Runtime data
pids
*.pid
*.seed

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage

# nyc test coverage
.nyc_output

# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# node-waf configuration
.lock-wscript

# Compiled binary addons (http://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules
.cache
dist
jspm_packages

lib
# Optional npm cache directory
.npm

# Optional REPL history
.node_repl_history

# macOS finder cache file
.DS_Store

# VS Code settings
.vscode

# IntelliJ
.idea
*.iml
.parcel-cache

# Cache
.cache

# Yalc
.yalc
yalc.lock

##npm package zips
*.tgz

# Compiled plugin
lib

4 changes: 4 additions & 0 deletions .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

npx --no -- commitlint --edit ""
4 changes: 4 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

npx lint-staged
1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
legacy-peer-deps=true
6 changes: 6 additions & 0 deletions .prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"semi": false,
"printWidth": 100,
"bracketSpacing": false,
"singleQuote": true
}
7 changes: 7 additions & 0 deletions .releaserc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"extends": "@sanity/semantic-release-preset",
"branches": [
"main",
{ "name": "v3", "channel": "studio-v3", "prerelease": "v3-studio" }
]
}
68 changes: 68 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
<!-- markdownlint-disable --><!-- textlint-disable -->

# 📓 Changelog

All notable changes to this project will be documented in this file. See
[Conventional Commits](https://conventionalcommits.org) for commit guidelines.

## [2.0.0-v3-studio.8](https://github.com/sanity-io/sanity-studio-secrets/compare/v2.0.0-v3-studio.7...v2.0.0-v3-studio.8) (2022-11-04)

### Bug Fixes

- **deps:** pkg-utils & @sanity/plugin-kit ([5bd94d5](https://github.com/sanity-io/sanity-studio-secrets/commit/5bd94d55b9369044e7a841d6300021af2f3fa7ca))

## [2.0.0-v3-studio.7](https://github.com/sanity-io/sanity-studio-secrets/compare/v2.0.0-v3-studio.6...v2.0.0-v3-studio.7) (2022-11-03)

### Bug Fixes

- compiled for sanity 3.0.0-rc.0 ([2b012f8](https://github.com/sanity-io/sanity-studio-secrets/commit/2b012f8c33a4bd14296c2038f55c1b4898434617))

## [2.0.0-v3-studio.6](https://github.com/sanity-io/sanity-studio-secrets/compare/v2.0.0-v3-studio.5...v2.0.0-v3-studio.6) (2022-10-31)

### Bug Fixes

- **docs:** use correct package name in README.md ([191246b](https://github.com/sanity-io/sanity-studio-secrets/commit/191246b76eea70a11f97e5f29f08f514ac8eb4c1))

## [2.0.0-v3-studio.5](https://github.com/sanity-io/sanity-studio-secrets/compare/v2.0.0-v3-studio.4...v2.0.0-v3-studio.5) (2022-10-31)

### Bug Fixes

- renamed package to @sanity/studio-secrets ([0a5aa16](https://github.com/sanity-io/sanity-studio-secrets/commit/0a5aa16d19ec2f3962a9b757af3c011fdcd3b3e5))

## [2.0.0-v3-studio.4](https://github.com/sanity-io/sanity-studio-secrets/compare/v2.0.0-v3-studio.3...v2.0.0-v3-studio.4) (2022-10-30)

### Bug Fixes

- fallback to empty value in key editor ([11a0456](https://github.com/sanity-io/sanity-studio-secrets/commit/11a0456f61b683deb8b3608cab443a50f0babbb2))

## [2.0.0-v3-studio.3](https://github.com/sanity-io/sanity-studio-secrets/compare/v2.0.0-v3-studio.2...v2.0.0-v3-studio.3) (2022-10-30)

### Bug Fixes

- corrected storeSecret key ([96f95f1](https://github.com/sanity-io/sanity-studio-secrets/commit/96f95f1c6f23f2f977f53b1827262cdd9a2ef1e1))

## [2.0.0-v3-studio.2](https://github.com/sanity-io/sanity-studio-secrets/compare/v2.0.0-v3-studio.1...v2.0.0-v3-studio.2) (2022-10-28)

### Bug Fixes

- **docs:** corrected install command ([dd8bfdc](https://github.com/sanity-io/sanity-studio-secrets/commit/dd8bfdcf219f0b1680524f7cc7b71ecdaffcc84c))

## [2.0.0-v3-studio.1](https://github.com/sanity-io/sanity-studio-secrets/compare/v1.1.0-v3-studio.1...v2.0.0-v3-studio.1) (2022-10-28)

### ⚠ BREAKING CHANGES

- package is now named @sanity/secrets instead of sanity-secrets

### Features

- renamed package to @sanity/secrets ([6fb61e4](https://github.com/sanity-io/sanity-studio-secrets/commit/6fb61e45610d72976e1aefe5ed08d7141f7884ea))

### Bug Fixes

- **release:** v3 release ([4d94493](https://github.com/sanity-io/sanity-studio-secrets/commit/4d944930b33b9b4aa16a124c948a2224550395f2))

## [1.1.0-v3-studio.1](https://github.com/sanity-io/sanity-studio-secrets/compare/v1.0.0...v1.1.0-v3-studio.1) (2022-10-28)

### Features

- initial v3 version ([e0b4e59](https://github.com/sanity-io/sanity-studio-secrets/commit/e0b4e59ea64de8b993cb4272d064a382341f6c76))
4 changes: 2 additions & 2 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2021 Rune Botten
Copyright (c) 2022 Sanity.io

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand All @@ -18,4 +18,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
SOFTWARE.
Loading

0 comments on commit 2e9f5f9

Please sign in to comment.