Skip to content

Commit f5a5e15

Browse files
authored
chore: Add auto-deployment via Changesets
1 parent 565f94e commit f5a5e15

File tree

10 files changed

+847
-120
lines changed

10 files changed

+847
-120
lines changed

.changeset/README.md

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Changesets
2+
3+
Hello and welcome! This folder has been automatically generated by `@changesets/cli`, a build tool that works
4+
with multi-package repos, or single-package repos to help you version and publish your code. You can
5+
find the full documentation for it [in our repository](https://github.com/changesets/changesets)
6+
7+
We have a quick list of common questions to get you started engaging with this project in
8+
[our documentation](https://github.com/changesets/changesets/blob/main/docs/common-questions.md)

.changeset/config.json

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"$schema": "https://unpkg.com/@changesets/[email protected]/schema.json",
3+
"changelog": [
4+
"@changesets/cli/changelog",
5+
{ "repo": "remix-run/web-std-io" }
6+
],
7+
"commit": false,
8+
"fixed": [],
9+
"linked": [],
10+
"access": "restricted",
11+
"baseBranch": "main",
12+
"updateInternalDependencies": "patch",
13+
"ignore": []
14+
}

.github/workflows/release.yml

+33-88
Original file line numberDiff line numberDiff line change
@@ -1,101 +1,46 @@
1+
name: release
12
on:
23
push:
34
branches:
45
- main
5-
name: release
6+
concurrency: ${{ github.workflow }}-${{ github.ref }}
7+
env:
8+
CI: true
69
jobs:
7-
changeFinder:
8-
runs-on: ubuntu-latest
9-
outputs:
10-
nodePaths: ${{ steps.interrogate.outputs.nodePaths }}
11-
steps:
12-
- uses: actions/checkout@v2
13-
- id: interrogate
14-
uses: actions/github-script@v4
15-
with:
16-
github-token: ${{secrets.GITHUB_TOKEN}}
17-
script: |
18-
const {execSync} = require('child_process');
19-
const [owner, repo] = process.env.GITHUB_REPOSITORY.split('/');
20-
const latestRelease = await github.repos.getLatestRelease({
21-
owner,
22-
repo
23-
});
24-
console.log(`latest release: ${JSON.stringify(latestRelease.data)}`);
25-
execSync('git pull --tags');
26-
execSync(`git reset --hard ${latestRelease.data.tag_name}`);
27-
const status = execSync(`git diff --name-only origin/main`, { encoding: 'utf-8'});
28-
console.log(status);
29-
const changes = status.split('\n');
30-
let nodePaths = new Set();
31-
for (const change of changes) {
32-
if (change.startsWith('packages/')) {
33-
const [,library] = change.split('/');
34-
nodePaths.add(library);
35-
};
36-
}
37-
nodePaths = Array.from(nodePaths);
38-
if(nodePaths.length === 0){
39-
console.log(`::warning::No changes found, release will be skipped.`)
40-
}
41-
console.log(`::set-output name=nodePaths::${JSON.stringify(nodePaths)}`);
42-
release-pr:
43-
runs-on: ubuntu-latest
44-
needs: changeFinder
45-
if: ${{ fromJson(needs.changeFinder.outputs.nodePaths)[0] != '' }}
46-
strategy:
47-
fail-fast: false
48-
matrix:
49-
package: ${{fromJson(needs.changeFinder.outputs.nodePaths)}}
50-
steps:
51-
- uses: google-github-actions/release-please-action@v2
52-
id: release-please
53-
with:
54-
path: packages/${{ matrix.package }}
55-
token: ${{ secrets.GITHUB_TOKEN }}
56-
release-type: node
57-
package-name: "@remix-run/web-${{ matrix.package }}"
58-
monorepo-tags: true
59-
changelog-types: '[{"type":"feat","section":"Features","hidden":false},{"type":"fix","section":"Bug Fixes","hidden":false},{"type":"refactor","section":"Changes","hidden":false},{"type":"chore","section":"Changes","hidden":false}]'
60-
command: release-pr
6110
release:
11+
name: release
12+
if: ${{ github.repository == 'remix-run/web-std-io' }}
6213
runs-on: ubuntu-latest
63-
needs: changeFinder
64-
if: ${{ fromJson(needs.changeFinder.outputs.nodePaths)[0] != '' }}
65-
strategy:
66-
fail-fast: false
67-
matrix:
68-
package: ${{fromJson(needs.changeFinder.outputs.nodePaths)}}
6914
steps:
70-
- uses: GoogleCloudPlatform/release-please-action@v2
71-
id: release
72-
with:
73-
path: packages/${{ matrix.package }}
74-
token: ${{ secrets.GITHUB_TOKEN }}
75-
release-type: node
76-
package-name: "@remix-run/web-${{ matrix.package }}"
77-
monorepo-tags: true
78-
changelog-types: '[{"type":"feat","section":"Features","hidden":false},{"type":"fix","section":"Bug Fixes","hidden":false},{"type":"refactor","section":"Changes","hidden":false},{"type":"chore","section":"Changes","hidden":false}]'
79-
command: github-release
80-
# The logic below handles the npm publication:
8115
- name: Checkout
82-
uses: actions/checkout@v2
83-
# these if statements ensure that a publication only occurs when
84-
# a new release is created:
85-
if: ${{ steps.release.outputs.release_created }}
86-
- name: Setup
87-
uses: actions/setup-node@v2
16+
uses: actions/checkout@v3
17+
with:
18+
fetch-depth: 0
19+
- name: Setup Node
20+
uses: actions/setup-node@v3
8821
with:
8922
node-version: 16
90-
registry-url: https://registry.npmjs.org/
91-
if: ${{ steps.release.outputs.release_created }}
23+
cache: 'yarn'
9224
- name: Install
93-
uses: bahmutov/npm-install@v1
94-
if: ${{ steps.release.outputs.release_created }}
95-
- name: Publish
96-
if: ${{ steps.release.outputs.release_created }}
97-
env:
98-
NODE_AUTH_TOKEN: ${{secrets.NPM_AUTH_TOKEN}}
25+
run: yarn install --frozen-lockfile
26+
- name: Auth
9927
run: |
100-
cd packages/${{ matrix.package }}
101-
npm publish --access=public
28+
echo "registry=https://registry.npmjs.org" >> ~/.npmrc
29+
echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" >> ~/.npmrc
30+
31+
# This action has two responsibilities. The first time the workflow runs
32+
# (initial push to `main`) it will create a new branch and then PR back
33+
# to `main` with the related changes for the new version. After the PR
34+
# is merged, the workflow will run again and this action will publish to
35+
# npm.
36+
- name: PR / Publish
37+
id: changesets
38+
uses: changesets/action@v1
39+
with:
40+
version: yarn version-bump
41+
commit: "chore: Update version for release"
42+
title: "chore: Update version for release"
43+
publish: yarn release
44+
env:
45+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
46+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

package.json

+11
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
{
2+
"name": "@remix-run/web-std-io",
23
"private": true,
34
"workspaces": [
45
"packages/blob",
@@ -8,6 +9,10 @@
89
"packages/stream"
910
],
1011
"scripts": {
12+
"changeset": "changeset",
13+
"release": "changeset publish",
14+
"version-bump": "changeset version",
15+
"postinstall": "manypkg fix",
1116
"prepare": "yarn prepare:blob && yarn prepare:file && yarn prepare:form-data && yarn prepare:fetch",
1217
"prepare:blob": "yarn --cwd packages/blob prepare",
1318
"prepare:file": "yarn --cwd packages/file prepare",
@@ -19,5 +24,11 @@
1924
"test:form-data": "yarn --cwd packages/form-data test",
2025
"test:fetch": "yarn --cwd packages/fetch test",
2126
"test:stream": "yarn --cwd packages/stream test"
27+
},
28+
"dependencies": {
29+
"@changesets/changelog-github": "0.4.4",
30+
"@changesets/cli": "^2.22.0",
31+
"@manypkg/cli": "0.19.1",
32+
"@manypkg/get-packages": "^1.1.3"
2233
}
2334
}

packages/blob/package.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,15 @@
2525
}
2626
},
2727
"dependencies": {
28-
"web-encoding": "1.1.5",
29-
"@remix-run/web-stream": "^1.0.3"
28+
"@remix-run/web-stream": "^1.0.3",
29+
"web-encoding": "1.1.5"
3030
},
3131
"author": "Irakli Gozalishvili <[email protected]> (https://gozala.io)",
3232
"repository": "https://github.com/remix-run/web-std-io",
3333
"license": "MIT",
3434
"devDependencies": {
35-
"@types/node": "15.0.2",
3635
"@remix-run/web-fetch": "^4.1.1",
36+
"@types/node": "15.0.2",
3737
"git-validate": "2.2.4",
3838
"husky": "^6.0.0",
3939
"lint-staged": "^11.0.0",

packages/fetch/package.json

+6-6
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,9 @@
7474
"homepage": "https://github.com/remix-run/web-std-io",
7575
"devDependencies": {
7676
"@types/chai": "^4.3.0",
77-
"@types/mocha": "^9.1.0",
7877
"@types/chai-as-promised": "^7.1.5",
7978
"@types/chai-string": "^1.4.2",
79+
"@types/mocha": "^9.1.0",
8080
"abort-controller": "^3.0.0",
8181
"abortcontroller-polyfill": "^1.7.1",
8282
"busboy": "^0.3.1",
@@ -91,18 +91,18 @@
9191
"formdata-node": "^2.4.0",
9292
"mocha": "^8.1.3",
9393
"p-timeout": "^3.2.0",
94-
"rollup": "^2.26.10",
94+
"rollup": "2.47.0",
9595
"tsd": "^0.13.1",
96-
"xo": "^0.33.1",
97-
"typescript": "^4.4.4"
96+
"typescript": "^4.4.4",
97+
"xo": "^0.33.1"
9898
},
9999
"dependencies": {
100100
"@remix-run/web-blob": "^3.0.4",
101101
"@remix-run/web-form-data": "^3.0.2",
102102
"@remix-run/web-stream": "^1.0.3",
103+
"@web3-storage/multipart-parser": "^1.0.0",
103104
"data-uri-to-buffer": "^3.0.1",
104-
"mrmime": "^1.0.0",
105-
"@web3-storage/multipart-parser": "^1.0.0"
105+
"mrmime": "^1.0.0"
106106
},
107107
"esm": {
108108
"sourceMap": true,

packages/file/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@
3535
"repository": "https://github.com/remix-run/web-std-io",
3636
"license": "MIT",
3737
"devDependencies": {
38-
"@types/node": "15.0.2",
3938
"@remix-run/web-fetch": "^4.1.1",
39+
"@types/node": "15.0.2",
4040
"git-validate": "2.2.4",
4141
"husky": "^6.0.0",
4242
"lint-staged": "^11.0.0",

packages/form-data/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,10 @@
3333
"repository": "https://github.com/remix-run/web-std-io",
3434
"license": "MIT",
3535
"devDependencies": {
36-
"@types/node": "15.0.2",
3736
"@remix-run/web-blob": "^3.0.4",
3837
"@remix-run/web-fetch": "^4.1.1",
3938
"@remix-run/web-file": "^3.0.2",
39+
"@types/node": "15.0.2",
4040
"git-validate": "2.2.4",
4141
"husky": "^6.0.0",
4242
"lint-staged": "^11.0.0",

packages/stream/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
"prettier": "^2.3.0",
4545
"rimraf": "3.0.2",
4646
"typescript": "^4.4.4",
47-
"uvu": "^0.5.2"
47+
"uvu": "0.5.2"
4848
},
4949
"scripts": {
5050
"typecheck": "tsc --build",

0 commit comments

Comments
 (0)