-
Notifications
You must be signed in to change notification settings - Fork 31
chore: add auto-deployment via Changesets #74
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
MichaelDeBoey
wants to merge
6
commits into
web-std:main
Choose a base branch
from
MichaelDeBoey:deploy
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
e55e8cf
fix(CI): stop testing on Node 14
MichaelDeBoey a4726c5
chore: Add auto-deployment via Changesets
chaance bddfc11
fix: cleanup repo name
MichaelDeBoey 580824b
fix: publish publicly to npm (#16)
mcansh 50d4009
fix: run `manypkg fix`
MichaelDeBoey a54426f
fix: cleanup repo name
MichaelDeBoey File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,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) |
This file contains hidden or 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,14 @@ | ||
{ | ||
"$schema": "https://unpkg.com/@changesets/[email protected]/schema.json", | ||
"changelog": [ | ||
"@changesets/cli/changelog", | ||
{ "repo": "web-std/io" } | ||
], | ||
"commit": false, | ||
"fixed": [], | ||
"linked": [], | ||
"access": "public", | ||
"baseBranch": "main", | ||
"updateInternalDependencies": "patch", | ||
"ignore": [] | ||
} |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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,102 +1,47 @@ | ||
name: release | ||
on: | ||
workflow_dispatch: | ||
push: | ||
branches: | ||
- main | ||
name: release | ||
concurrency: ${{ github.workflow }}-${{ github.ref }} | ||
env: | ||
CI: true | ||
jobs: | ||
changeFinder: | ||
runs-on: ubuntu-latest | ||
outputs: | ||
nodePaths: ${{ steps.interrogate.outputs.nodePaths }} | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- id: interrogate | ||
uses: actions/github-script@v4 | ||
with: | ||
github-token: ${{secrets.GITHUB_TOKEN}} | ||
script: | | ||
const {execSync} = require('child_process'); | ||
const [owner, repo] = process.env.GITHUB_REPOSITORY.split('/'); | ||
const latestRelease = await github.repos.getLatestRelease({ | ||
owner, | ||
repo | ||
}); | ||
console.log(`latest release: ${JSON.stringify(latestRelease.data)}`); | ||
execSync('git pull --tags'); | ||
execSync(`git reset --hard ${latestRelease.data.tag_name}`); | ||
const status = execSync(`git diff --name-only origin/main`, { encoding: 'utf-8'}); | ||
console.log(status); | ||
const changes = status.split('\n'); | ||
let nodePaths = new Set(); | ||
for (const change of changes) { | ||
if (change.startsWith('packages/')) { | ||
const [,library] = change.split('/'); | ||
nodePaths.add(library); | ||
}; | ||
} | ||
nodePaths = Array.from(nodePaths); | ||
if(nodePaths.length === 0){ | ||
console.log(`::warning::No changes found, release will be skipped.`) | ||
} | ||
console.log(`::set-output name=nodePaths::${JSON.stringify(nodePaths)}`); | ||
release-pr: | ||
runs-on: ubuntu-latest | ||
needs: changeFinder | ||
if: ${{ fromJson(needs.changeFinder.outputs.nodePaths)[0] != '' }} | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
package: ${{fromJson(needs.changeFinder.outputs.nodePaths)}} | ||
steps: | ||
- uses: google-github-actions/release-please-action@v2 | ||
id: release-please | ||
with: | ||
path: packages/${{ matrix.package }} | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
release-type: node | ||
package-name: "@web-std/${{ matrix.package }}" | ||
monorepo-tags: true | ||
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}]' | ||
command: release-pr | ||
release: | ||
name: release | ||
if: ${{ github.repository == 'web-std/io' }} | ||
runs-on: ubuntu-latest | ||
needs: changeFinder | ||
if: ${{ fromJson(needs.changeFinder.outputs.nodePaths)[0] != '' }} | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
package: ${{fromJson(needs.changeFinder.outputs.nodePaths)}} | ||
steps: | ||
- uses: GoogleCloudPlatform/release-please-action@v2 | ||
id: release | ||
with: | ||
path: packages/${{ matrix.package }} | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
release-type: node | ||
package-name: "@web-std/${{ matrix.package }}" | ||
monorepo-tags: true | ||
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}]' | ||
command: github-release | ||
# The logic below handles the npm publication: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
# these if statements ensure that a publication only occurs when | ||
# a new release is created: | ||
if: ${{ steps.release.outputs.release_created }} | ||
- name: Setup | ||
uses: actions/setup-node@v2 | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
- name: Setup Node | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: 16 | ||
registry-url: https://registry.npmjs.org/ | ||
if: ${{ steps.release.outputs.release_created }} | ||
cache: 'yarn' | ||
- name: Install | ||
uses: bahmutov/npm-install@v1 | ||
if: ${{ steps.release.outputs.release_created }} | ||
- name: Publish | ||
if: ${{ steps.release.outputs.release_created }} | ||
env: | ||
NODE_AUTH_TOKEN: ${{secrets.NPM_AUTH_TOKEN}} | ||
run: yarn install --frozen-lockfile | ||
- name: Auth | ||
run: | | ||
cd packages/${{ matrix.package }} | ||
npm publish --access=public | ||
echo "registry=https://registry.npmjs.org" >> ~/.npmrc | ||
echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" >> ~/.npmrc | ||
|
||
# This action has two responsibilities. The first time the workflow runs | ||
# (initial push to `main`) it will create a new branch and then PR back | ||
# to `main` with the related changes for the new version. After the PR | ||
# is merged, the workflow will run again and this action will publish to | ||
# npm. | ||
- name: PR / Publish | ||
id: changesets | ||
uses: changesets/action@v1 | ||
with: | ||
version: yarn version-bump | ||
commit: "chore: Update version for release" | ||
title: "chore: Update version for release" | ||
publish: yarn release | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} |
This file contains hidden or 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 hidden or 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 hidden or 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 |
---|---|---|
|
@@ -25,15 +25,15 @@ | |
} | ||
}, | ||
"dependencies": { | ||
"web-encoding": "1.1.5", | ||
"@web-std/stream": "1.0.0" | ||
"@web-std/stream": "^1.0.3", | ||
"web-encoding": "1.1.5" | ||
}, | ||
"author": "Irakli Gozalishvili <[email protected]> (https://gozala.io)", | ||
"repository": "https://github.com/web-std/io", | ||
"license": "MIT", | ||
"devDependencies": { | ||
"@types/node": "15.0.2", | ||
"@web-std/fetch": "^3.0.0", | ||
"@web-std/fetch": "^4.1.2", | ||
"git-validate": "2.2.4", | ||
"husky": "^6.0.0", | ||
"lint-staged": "^11.0.0", | ||
|
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.