forked from remix-run/remix
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add GitHub Actions test + release scripts
- Loading branch information
Showing
16 changed files
with
955 additions
and
103 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains 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,47 @@ | ||
name: release | ||
|
||
on: | ||
push: | ||
tags: | ||
- v* | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- run: echo "::set-output name=version::$(cat .nvmrc)" | ||
id: nvmrc | ||
|
||
- name: Setup node | ||
uses: actions/setup-node@v1 | ||
with: | ||
node-version: "${{ steps.nvmrc.outputs.version }}" | ||
|
||
- run: echo "::set-output name=dir::$(yarn cache dir)" | ||
id: yarn-cache | ||
|
||
- name: Restore dependency cache | ||
uses: actions/cache@v2 | ||
with: | ||
path: "${{ steps.yarn-cache.outputs.dir }}" | ||
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} | ||
restore-keys: | | ||
${{ runner.os }}-yarn- | ||
${{ runner.os }}- | ||
- name: Install dependencies | ||
run: yarn --frozen-lockfile | ||
|
||
- name: Build | ||
run: yarn build | ||
|
||
- name: Test | ||
run: yarn test | ||
|
||
- name: Setup npm auth | ||
run: echo "//npm.pkg.github.com/:_authToken=${{ secrets.REGISTRY_PUBLISH_SECRET }}" > ~/.npmrc | ||
|
||
- name: Publish | ||
run: yarn run publish |
This file contains 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,43 @@ | ||
name: test | ||
|
||
on: | ||
push: | ||
branches: | ||
- "**" | ||
tags-ignore: | ||
- v* | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- run: echo "::set-output name=version::$(cat .nvmrc)" | ||
id: nvmrc | ||
|
||
- name: Setup node | ||
uses: actions/setup-node@v1 | ||
with: | ||
node-version: "${{ steps.nvmrc.outputs.version }}" | ||
|
||
- run: echo "::set-output name=dir::$(yarn cache dir)" | ||
id: yarn-cache | ||
|
||
- name: Restore dependency cache | ||
uses: actions/cache@v2 | ||
with: | ||
path: "${{ steps.yarn-cache.outputs.dir }}" | ||
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} | ||
restore-keys: | | ||
${{ runner.os }}-yarn- | ||
${{ runner.os }}- | ||
- name: Install dependencies | ||
run: yarn --frozen-lockfile | ||
|
||
- name: Build | ||
run: yarn build | ||
|
||
- name: Test | ||
run: yarn test |
This file contains 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 @@ | ||
@remix-run:registry=https://npm.pkg.github.com |
This file contains 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,11 +1,39 @@ | ||
Welcome to Remix! | ||
|
||
GitHub Actions suck! | ||
|
||
// in .npmrc | ||
@remix-run:registry=https://npm.pkg.github.com | ||
## Development | ||
|
||
// in the cli | ||
yarn add @remix-run/react @remix-run/express | ||
``` | ||
# install everything | ||
yarn install | ||
# run the build | ||
yarn build | ||
# run the tests | ||
yarn test | ||
# run the tests for a specific package | ||
yarn test react | ||
# run the tests in watch mode | ||
yarn test react --watch | ||
# cut a release | ||
yarn run version major|minor|patch|prerelease [prereleaseId] | ||
yarn publish | ||
# or | ||
git push origin --follow-tags | ||
``` | ||
|
||
## For Users | ||
|
||
yarn add remix | ||
remix register | ||
``` | ||
# in ~/.npmrc | ||
//npm.pkg.github.com/:_authToken=GITHUB_PERSONAL_ACCESS_TOKEN | ||
# in project .npmrc | ||
@remix-run:registry=https://npm.pkg.github.com | ||
# to install | ||
yarn add @remix-run/react @remix-run/express | ||
``` |
This file contains 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 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,4 +1,5 @@ | ||
{ | ||
"name": "@remix-run/core", | ||
"version": "0.0.0" | ||
"version": "0.0.2", | ||
"repository": "https://github.com/remix-run/packages" | ||
} |
This file contains 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,4 +1,8 @@ | ||
{ | ||
"name": "@remix-run/express", | ||
"version": "0.0.0" | ||
"version": "0.0.2", | ||
"repository": "https://github.com/remix-run/packages", | ||
"dependencies": { | ||
"@remix-run/core": "0.0.2" | ||
} | ||
} |
This file contains 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 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,26 +1,33 @@ | ||
import { exec } from "./utils.js"; | ||
import { exec } from "child_process"; | ||
import { promisify } from "util"; | ||
|
||
async function build() { | ||
await exec("tsc -b"); | ||
const x = promisify(exec); | ||
|
||
await exec("mkdir -p build/@remix-run"); | ||
async function run() { | ||
await x("tsc -b"); | ||
|
||
await Promise.all([ | ||
exec("cp -r .tsc-output/core build/@remix-run/core"), | ||
exec("cp packages/core/package.json build/@remix-run/core/package.json"), | ||
await x("mkdir -p build/@remix-run"); | ||
|
||
exec("cp -r .tsc-output/express build/@remix-run/express"), | ||
exec( | ||
"cp packages/express/package.json build/@remix-run/express/package.json" | ||
), | ||
await x("cp -r .tsc-output/core build/@remix-run/core"); | ||
await x("cp packages/core/package.json build/@remix-run/core/package.json"); | ||
|
||
exec("cp -r .tsc-output/react build/@remix-run/react"), | ||
exec("cp packages/react/package.json build/@remix-run/react/package.json") | ||
]); | ||
await x("cp -r .tsc-output/express build/@remix-run/express"); | ||
await x( | ||
"cp packages/express/package.json build/@remix-run/express/package.json" | ||
); | ||
|
||
await x("cp -r .tsc-output/react build/@remix-run/react"); | ||
await x("cp packages/react/package.json build/@remix-run/react/package.json"); | ||
|
||
return 0; | ||
} | ||
|
||
build().then(code => { | ||
process.exit(code); | ||
}); | ||
run().then( | ||
code => { | ||
process.exit(code); | ||
}, | ||
error => { | ||
console.error(error); | ||
process.exit(1); | ||
} | ||
); |
This file contains 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,58 @@ | ||
import path from "path"; | ||
import { promises as fsp } from "fs"; | ||
import { exec, spawn } from "child_process"; | ||
import { promisify } from "util"; | ||
import { fileURLToPath } from "url"; | ||
|
||
const dirname = path.dirname(fileURLToPath(import.meta.url)); | ||
const buildDir = path.resolve(dirname, "../build/@remix-run"); | ||
|
||
const x = promisify(exec); | ||
|
||
function invariant(cond, message) { | ||
if (!cond) throw new Error(message); | ||
} | ||
|
||
function npm(args, options) { | ||
return new Promise((accept, reject) => { | ||
spawn("npm", args, options).on("close", code => { | ||
code === 0 ? accept() : reject(); | ||
}); | ||
}); | ||
} | ||
|
||
async function getTaggedVersion() { | ||
let output = (await x("git tag --list --points-at HEAD")).toString().trim(); | ||
return output.replace(/^v/g, ""); | ||
} | ||
|
||
async function run() { | ||
// 0. Make sure there's a current tag | ||
let taggedVersion = await getTaggedVersion(); | ||
invariant( | ||
taggedVersion !== "", | ||
`Missing release version. Run the version script first.` | ||
); | ||
|
||
// 1. Publish all packages, starting with core | ||
let buildNames = await fsp.readdir(buildDir); | ||
buildNames.sort((a, b) => (a === "core" ? -1 : 0)); | ||
|
||
for (let name of buildNames) { | ||
await npm(["publish", path.join(buildDir, name)], { | ||
stdio: "inherit" | ||
}); | ||
} | ||
|
||
return 0; | ||
} | ||
|
||
run().then( | ||
code => { | ||
process.exit(code); | ||
}, | ||
error => { | ||
console.error(error); | ||
process.exit(1); | ||
} | ||
); |
Oops, something went wrong.