mirror of
https://github.com/Shopify/draggable.git
synced 2026-02-01 16:46:56 +00:00
commit
6c1b0b6f45
8
.changeset/README.md
Normal file
8
.changeset/README.md
Normal file
@ -0,0 +1,8 @@
|
||||
# Changesets
|
||||
|
||||
Hello and welcome! This folder has been automatically generated by `@changesets/cli`, a build tool that works
|
||||
with multi-package repos, or single-package repos to help you version and publish your code. You can
|
||||
find the full documentation for it [in our repository](https://github.com/changesets/changesets)
|
||||
|
||||
We have a quick list of common questions to get you started engaging with this project in
|
||||
[our documentation](https://github.com/changesets/changesets/blob/main/docs/common-questions.md)
|
||||
11
.changeset/config.json
Normal file
11
.changeset/config.json
Normal file
@ -0,0 +1,11 @@
|
||||
{
|
||||
"$schema": "https://unpkg.com/@changesets/config@2.3.1/schema.json",
|
||||
"changelog": ["@changesets/changelog-github", {"repo": "Shopify/draggable"}],
|
||||
"commit": false,
|
||||
"fixed": [],
|
||||
"linked": [],
|
||||
"access": "public",
|
||||
"baseBranch": "main",
|
||||
"updateInternalDependencies": "patch",
|
||||
"ignore": []
|
||||
}
|
||||
30
.github/workflows/changelog.yml
vendored
Normal file
30
.github/workflows/changelog.yml
vendored
Normal file
@ -0,0 +1,30 @@
|
||||
name: Changelog
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
types:
|
||||
- labeled
|
||||
- unlabeled
|
||||
- opened
|
||||
- synchronize
|
||||
- reopened
|
||||
|
||||
jobs:
|
||||
check:
|
||||
if: |
|
||||
!contains(github.event.pull_request.head.ref, 'changeset-release') &&
|
||||
!contains(github.event.pull_request.labels.*.name, '🤖Skip Changelog')
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout branch
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: 18.17.1
|
||||
|
||||
- name: Check for Changeset
|
||||
run: npx @changesets/cli status --since="origin/main"
|
||||
37
.github/workflows/release.yml
vendored
Normal file
37
.github/workflows/release.yml
vendored
Normal file
@ -0,0 +1,37 @@
|
||||
name: Release
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
|
||||
concurrency: ${{ github.workflow }}-${{ github.ref }}
|
||||
|
||||
jobs:
|
||||
release:
|
||||
name: Release
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout Repo
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: '18.17.1'
|
||||
cache: 'yarn'
|
||||
|
||||
- name: Install dependencies
|
||||
run: yarn --frozen-lockfile
|
||||
|
||||
- name: Create release Pull Request or publish to NPM
|
||||
id: changesets
|
||||
uses: changesets/action@v1
|
||||
with:
|
||||
version: yarn version-packages
|
||||
publish: yarn release
|
||||
env:
|
||||
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
139
.github/workflows/snapit.yml
vendored
Normal file
139
.github/workflows/snapit.yml
vendored
Normal file
@ -0,0 +1,139 @@
|
||||
name: Snapshot
|
||||
|
||||
on:
|
||||
issue_comment:
|
||||
types:
|
||||
- created
|
||||
|
||||
concurrency: ${{ github.workflow }}-${{ github.ref }}
|
||||
|
||||
jobs:
|
||||
snapshot:
|
||||
name: Snapshot Release
|
||||
if: |
|
||||
github.event.issue.pull_request &&
|
||||
(startsWith(github.event.comment.body, '/snapit') || startsWith(github.event.comment.body, '/snapshot-release'))
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Enforce permission requirement
|
||||
uses: prince-chrismc/check-actor-permissions-action@v1
|
||||
with:
|
||||
permission: write
|
||||
|
||||
- name: Add initial reaction
|
||||
uses: peter-evans/create-or-update-comment@v2
|
||||
with:
|
||||
comment-id: ${{ github.event.comment.id }}
|
||||
reactions: eyes
|
||||
|
||||
- name: Validate pull request
|
||||
uses: actions/github-script@v6
|
||||
id: pr_data
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
script: |
|
||||
try {
|
||||
const pullRequest = await github.rest.pulls.get({
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
pull_number: context.issue.number,
|
||||
})
|
||||
|
||||
// Pull request from fork
|
||||
if (context.payload.repository.full_name !== pullRequest.data.head.repo.full_name) {
|
||||
const errorMessage = '`/snapit` is not supported on pull requests from forked repositories.'
|
||||
|
||||
await github.rest.issues.createComment({
|
||||
issue_number: context.issue.number,
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
body: errorMessage,
|
||||
})
|
||||
|
||||
core.setFailed(errorMessage)
|
||||
}
|
||||
} catch (err) {
|
||||
core.setFailed(`Request failed with error ${err}`)
|
||||
}
|
||||
|
||||
- name: Checkout default branch
|
||||
uses: actions/checkout@v3
|
||||
|
||||
# issue_comment requires us to checkout the branch
|
||||
# https://github.com/actions/checkout/issues/331#issuecomment-1120113003
|
||||
- name: Checkout pull request branch
|
||||
run: hub pr checkout ${{ github.event.issue.number }}
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
# Because changeset entries are consumed and removed on the
|
||||
# 'changeset-release/main' branch, we need to reset the files
|
||||
# so the following 'changeset version --snapshot' command will
|
||||
# regenerate the package version bumps with the snapshot releases
|
||||
- name: Reset changeset entries on changeset-release/main branch
|
||||
run: |
|
||||
if [[ $(git branch --show-current) == 'changeset-release/main' ]]; then
|
||||
git checkout origin/main -- .changeset
|
||||
fi
|
||||
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: '18.17.1'
|
||||
|
||||
- name: Install dependencies
|
||||
run: yarn --frozen-lockfile
|
||||
|
||||
- name: Create an .npmrc
|
||||
env:
|
||||
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
|
||||
run: |
|
||||
cat << EOF > "$HOME/.npmrc"
|
||||
//registry.npmjs.org/:_authToken=$NPM_TOKEN
|
||||
EOF
|
||||
|
||||
- name: Create and publish snapshot release
|
||||
uses: actions/github-script@v6
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
script: |
|
||||
const execa = require('execa')
|
||||
|
||||
const releaseProcess = execa.command('yarn release -- --no-git-tags --snapshot --tag snapshot-release')
|
||||
releaseProcess.stdout.pipe(process.stdout)
|
||||
|
||||
const {stdout} = await releaseProcess
|
||||
|
||||
const newTags = Array
|
||||
.from(stdout.matchAll(/New tag:\s+([^\s\n]+)/g))
|
||||
.map(([_, tag]) => tag)
|
||||
|
||||
if (newTags.length) {
|
||||
const multiple = newTags.length > 1
|
||||
|
||||
const body = (
|
||||
`🫰✨ **Thanks @${context.actor}! ` +
|
||||
`Your snapshot${multiple ? 's have' : ' has'} been published to npm.**\n\n` +
|
||||
`Test the snapshot${multiple ? 's' : ''} by updating your \`package.json\` ` +
|
||||
`with the newly published version${multiple ? 's' : ''}:\n` +
|
||||
newTags.map(tag => (
|
||||
'```sh\n' +
|
||||
`yarn add ${tag}\n` +
|
||||
'```'
|
||||
)).join('\n')
|
||||
)
|
||||
await github.rest.issues.createComment({
|
||||
issue_number: context.issue.number,
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
body,
|
||||
})
|
||||
}
|
||||
|
||||
- name: Add final reaction
|
||||
uses: peter-evans/create-or-update-comment@v2
|
||||
with:
|
||||
comment-id: ${{ github.event.comment.id }}
|
||||
reactions: rocket
|
||||
@ -28,8 +28,7 @@
|
||||
"start": "concurrently \"yarn watch\" \"cd examples && yarn && yarn start\"",
|
||||
"build": "yarn build:production",
|
||||
"watch": "ts-node --project='./scripts/tsconfig.json' ./scripts/watch.ts",
|
||||
"prepare": "yarn build:development",
|
||||
"prepublishOnly": "yarn build:production",
|
||||
"release": "yarn run build:production && changeset publish",
|
||||
"lint": "eslint ./src ./scripts ./test --max-warnings 0",
|
||||
"type-check": "tsc --noEmit",
|
||||
"type-check:scripts": "tsc --noEmit --project scripts",
|
||||
@ -46,6 +45,8 @@
|
||||
],
|
||||
"devDependencies": {
|
||||
"@babel/core": "^7.22.20",
|
||||
"@changesets/changelog-github": "^0.4.8",
|
||||
"@changesets/cli": "^2.26.2",
|
||||
"@microsoft/tsdoc": "^0.14.2",
|
||||
"@shopify/babel-preset": "^25.0.0",
|
||||
"@shopify/eslint-plugin": "^43.0.0",
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user