Skip to content

Commit 38b8d11

Browse files
chaanceMichaelDeBoey
authored andcommitted
chore: Add auto-deployment via Changesets
1 parent 73877fc commit 38b8d11

File tree

10 files changed

+844
-117
lines changed

10 files changed

+844
-117
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,102 +1,47 @@
1+
name: release
12
on:
23
workflow_dispatch:
34
push:
45
branches:
56
- main
6-
name: release
7+
concurrency: ${{ github.workflow }}-${{ github.ref }}
8+
env:
9+
CI: true
710
jobs:
8-
changeFinder:
9-
runs-on: ubuntu-latest
10-
outputs:
11-
nodePaths: ${{ steps.interrogate.outputs.nodePaths }}
12-
steps:
13-
- uses: actions/checkout@v2
14-
- id: interrogate
15-
uses: actions/github-script@v4
16-
with:
17-
github-token: ${{secrets.GITHUB_TOKEN}}
18-
script: |
19-
const {execSync} = require('child_process');
20-
const [owner, repo] = process.env.GITHUB_REPOSITORY.split('/');
21-
const latestRelease = await github.repos.getLatestRelease({
22-
owner,
23-
repo
24-
});
25-
console.log(`latest release: ${JSON.stringify(latestRelease.data)}`);
26-
execSync('git pull --tags');
27-
execSync(`git reset --hard ${latestRelease.data.tag_name}`);
28-
const status = execSync(`git diff --name-only origin/main`, { encoding: 'utf-8'});
29-
console.log(status);
30-
const changes = status.split('\n');
31-
let nodePaths = new Set();
32-
for (const change of changes) {
33-
if (change.startsWith('packages/')) {
34-
const [,library] = change.split('/');
35-
nodePaths.add(library);
36-
};
37-
}
38-
nodePaths = Array.from(nodePaths);
39-
if(nodePaths.length === 0){
40-
console.log(`::warning::No changes found, release will be skipped.`)
41-
}
42-
console.log(`::set-output name=nodePaths::${JSON.stringify(nodePaths)}`);
43-
release-pr:
44-
runs-on: ubuntu-latest
45-
needs: changeFinder
46-
if: ${{ fromJson(needs.changeFinder.outputs.nodePaths)[0] != '' }}
47-
strategy:
48-
fail-fast: false
49-
matrix:
50-
package: ${{fromJson(needs.changeFinder.outputs.nodePaths)}}
51-
steps:
52-
- uses: google-github-actions/release-please-action@v2
53-
id: release-please
54-
with:
55-
path: packages/${{ matrix.package }}
56-
token: ${{ secrets.GITHUB_TOKEN }}
57-
release-type: node
58-
package-name: "@web-std/${{ matrix.package }}"
59-
monorepo-tags: true
60-
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}]'
61-
command: release-pr
6211
release:
12+
name: release
13+
if: ${{ github.repository == 'remix-run/web-std-io' }}
6314
runs-on: ubuntu-latest
64-
needs: changeFinder
65-
if: ${{ fromJson(needs.changeFinder.outputs.nodePaths)[0] != '' }}
66-
strategy:
67-
fail-fast: false
68-
matrix:
69-
package: ${{fromJson(needs.changeFinder.outputs.nodePaths)}}
7015
steps:
71-
- uses: GoogleCloudPlatform/release-please-action@v2
72-
id: release
73-
with:
74-
path: packages/${{ matrix.package }}
75-
token: ${{ secrets.GITHUB_TOKEN }}
76-
release-type: node
77-
package-name: "@web-std/${{ matrix.package }}"
78-
monorepo-tags: true
79-
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}]'
80-
command: github-release
81-
# The logic below handles the npm publication:
8216
- name: Checkout
83-
uses: actions/checkout@v2
84-
# these if statements ensure that a publication only occurs when
85-
# a new release is created:
86-
if: ${{ steps.release.outputs.release_created }}
87-
- name: Setup
88-
uses: actions/setup-node@v2
17+
uses: actions/checkout@v3
18+
with:
19+
fetch-depth: 0
20+
- name: Setup Node
21+
uses: actions/setup-node@v3
8922
with:
9023
node-version: 16
91-
registry-url: https://registry.npmjs.org/
92-
if: ${{ steps.release.outputs.release_created }}
24+
cache: 'yarn'
9325
- name: Install
94-
uses: bahmutov/npm-install@v1
95-
if: ${{ steps.release.outputs.release_created }}
96-
- name: Publish
97-
if: ${{ steps.release.outputs.release_created }}
98-
env:
99-
NODE_AUTH_TOKEN: ${{secrets.NPM_AUTH_TOKEN}}
26+
run: yarn install --frozen-lockfile
27+
- name: Auth
10028
run: |
101-
cd packages/${{ matrix.package }}
102-
npm publish --access=public
29+
echo "registry=https://registry.npmjs.org" >> ~/.npmrc
30+
echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" >> ~/.npmrc
31+
32+
# This action has two responsibilities. The first time the workflow runs
33+
# (initial push to `main`) it will create a new branch and then PR back
34+
# to `main` with the related changes for the new version. After the PR
35+
# is merged, the workflow will run again and this action will publish to
36+
# npm.
37+
- name: PR / Publish
38+
id: changesets
39+
uses: changesets/action@v1
40+
with:
41+
version: yarn version-bump
42+
commit: "chore: Update version for release"
43+
title: "chore: Update version for release"
44+
publish: yarn release
45+
env:
46+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
47+
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-
"@web-std/stream": "1.0.0"
28+
"@web-std/stream": "1.0.0",
29+
"web-encoding": "1.1.5"
3030
},
3131
"author": "Irakli Gozalishvili <[email protected]> (https://gozala.io)",
3232
"repository": "https://github.com/web-std/io",
3333
"license": "MIT",
3434
"devDependencies": {
35+
"@remix-run/web-fetch": "^4.1.1",
3536
"@types/node": "15.0.2",
36-
"@web-std/fetch": "^3.0.0",
3737
"git-validate": "2.2.4",
3838
"husky": "^6.0.0",
3939
"lint-staged": "^11.0.0",

packages/fetch/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@
9292
"formdata-node": "^2.4.0",
9393
"mocha": "^8.1.3",
9494
"p-timeout": "^3.2.0",
95-
"rollup": "^2.26.10",
95+
"rollup": "2.47.0",
9696
"tsd": "^0.13.1",
9797
"typescript": "^4.4.4",
9898
"xo": "^0.33.1"

packages/file/package.json

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

packages/form-data/package.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,10 @@
3434
"repository": "https://github.com/web-std/io",
3535
"license": "MIT",
3636
"devDependencies": {
37+
"@remix-run/web-blob": "^3.0.4",
38+
"@remix-run/web-fetch": "^4.1.1",
39+
"@remix-run/web-file": "^3.0.2",
3740
"@types/node": "15.0.2",
38-
"@web-std/blob": "^3.0.0",
39-
"@web-std/fetch": "^3.0.0",
40-
"@web-std/file": "^3.0.0",
4141
"git-validate": "2.2.4",
4242
"husky": "^6.0.0",
4343
"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)