-
Notifications
You must be signed in to change notification settings - Fork 366
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci: add workflows and semantic release (#86)
- Loading branch information
Showing
14 changed files
with
3,912 additions
and
881 deletions.
There are no files selected for viewing
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,96 @@ | ||
name: Release (Canary) | ||
|
||
on: | ||
push: | ||
branches: | ||
- next | ||
|
||
jobs: | ||
bundler: | ||
name: Build bundler | ||
if: github.event_name == 'push' && github.ref == 'refs/heads/next' | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Setup | Clone codesandbox-client | ||
uses: actions/checkout@v2 | ||
with: | ||
repository: codesandbox/codesandbox-client | ||
|
||
- uses: actions/cache@v2 | ||
with: | ||
path: "**/node_modules" | ||
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }} | ||
|
||
- name: Setup | Node.js | ||
uses: actions/setup-node@v2 | ||
with: | ||
node-version: "10.23.2" | ||
registry-url: "https://npm.pkg.github.com/" | ||
|
||
- name: Setup | Install dependencies | ||
run: yarn | ||
|
||
- name: Prepare | Build dependencies | ||
run: yarn build:deps | ||
|
||
- name: Prepare | Build sandpack bundler | ||
run: yarn build:sandpack | ||
|
||
- name: Archive bundler artifacts | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: bundler | ||
path: www/**/*.* | ||
|
||
publish: | ||
name: Publish | ||
runs-on: ubuntu-latest | ||
needs: [bundler] | ||
env: | ||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
steps: | ||
- name: Setup | Checkout | ||
uses: actions/checkout@v2 | ||
with: | ||
# pulls all commits (needed for lerna / semantic release to correctly version) | ||
fetch-depth: "0" | ||
|
||
- name: Setup | Node.js | ||
uses: actions/setup-node@v2 | ||
with: | ||
node-version: "12.22.4" | ||
|
||
- name: Setup | Authenticate with Registry | ||
run: echo //registry.npmjs.org/:_authToken=${NPM_TOKEN} > .npmrc | ||
env: | ||
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | ||
|
||
- name: Setup | Configure git user | ||
run: | | ||
git config --global user.name "${{ github.actor }}" | ||
git config --global user.email "${{ github.actor }}@users.noreply.github.com" | ||
- uses: actions/cache@v2 | ||
with: | ||
path: "**/node_modules" | ||
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }} | ||
|
||
- name: Setup | Install dependencies | ||
run: yarn install --frozen-lockfile | ||
|
||
- name: Prepare | Download artifacts | ||
uses: actions/download-artifact@v2 | ||
with: | ||
name: bundler | ||
path: bundler | ||
|
||
- name: Prepare | Build | ||
run: | | ||
yarn workspace @codesandbox/sandpack-client build:publish | ||
yarn workspace @codesandbox/sandpack-react build:publish | ||
- name: Release | Lerna Publish | ||
run: lerna publish from-package --yes --canary |
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,41 @@ | ||
name: Continuous Integration | ||
on: push | ||
|
||
jobs: | ||
lint: | ||
name: Lint | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 10 | ||
steps: | ||
- name: Setup | Checkout | ||
uses: actions/checkout@v1 | ||
|
||
- uses: actions/cache@v2 | ||
with: | ||
path: "**/node_modules" | ||
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }} | ||
|
||
- name: Setup | Install dependencies | ||
run: yarn install --frozen-lockfile | ||
|
||
- name: Lint | Eslint | ||
run: yarn run lint | ||
|
||
build: | ||
name: Build | ||
runs-on: ubuntu-18.04 | ||
timeout-minutes: 10 | ||
steps: | ||
- name: Setup | Checkout | ||
uses: actions/checkout@v1 | ||
|
||
- uses: actions/cache@v2 | ||
with: | ||
path: "**/node_modules" | ||
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }} | ||
|
||
- name: Setup | Install dependencies | ||
run: yarn install --frozen-lockfile | ||
|
||
- name: Build | ||
run: yarn run build |
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,17 @@ | ||
name: "Lint PR" | ||
|
||
on: | ||
pull_request: | ||
types: | ||
- opened | ||
- edited | ||
- synchronize | ||
|
||
jobs: | ||
main: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Lint | Lint PR Title | ||
uses: amannn/[email protected] | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
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,93 @@ | ||
name: Release | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
bundler: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Setup | Clone codesandbox-client | ||
uses: actions/checkout@v2 | ||
with: | ||
repository: codesandbox/codesandbox-client | ||
|
||
- uses: actions/cache@v2 | ||
with: | ||
path: "**/node_modules" | ||
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }} | ||
|
||
- name: Setup | Node.js | ||
uses: actions/setup-node@v2 | ||
with: | ||
node-version: "10.23.2" | ||
registry-url: "https://npm.pkg.github.com/" | ||
|
||
- name: Setup | Install dependencies | ||
run: yarn | ||
|
||
- name: Prepare | Build dependencies | ||
run: yarn build:deps | ||
|
||
- name: Prepare | Build CodeSandbox bundler | ||
run: yarn build:sandpack | ||
|
||
- name: Archive bundler artifacts | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: bundler | ||
path: www/**/*.* | ||
|
||
publish: | ||
runs-on: ubuntu-latest | ||
needs: [bundler] | ||
env: | ||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
steps: | ||
- name: Setup | Checkout | ||
uses: actions/checkout@v2 | ||
with: | ||
# pulls all commits (needed for lerna / semantic release to correctly version) | ||
fetch-depth: "0" | ||
|
||
- name: Setup | Node.js | ||
uses: actions/setup-node@v2 | ||
with: | ||
node-version: "12.22.4" | ||
|
||
- name: Setup | Authenticate with Registry | ||
run: echo //registry.npmjs.org/:_authToken=${NPM_TOKEN} > .npmrc | ||
env: | ||
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | ||
|
||
- name: Setup | Configure git user | ||
run: | | ||
git config --global user.name "${{ github.actor }}" | ||
git config --global user.email "${{ github.actor }}@users.noreply.github.com" | ||
- uses: actions/cache@v2 | ||
with: | ||
path: "**/node_modules" | ||
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }} | ||
|
||
- name: Setup | Install dependencies | ||
run: yarn install --frozen-lockfile | ||
|
||
- name: Prepare | Download artifacts | ||
uses: actions/download-artifact@v2 | ||
with: | ||
name: bundler | ||
path: bundler | ||
|
||
- name: Prepare | Build | ||
run: | | ||
yarn workspace @codesandbox/sandpack-client build:publish | ||
yarn workspace @codesandbox/sandpack-react build:publish | ||
- name: Release | Lerna Publish | ||
run: lerna publish from-package --yes |
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,3 @@ | ||
#!/bin/sh | ||
. "$(dirname "$0")/_/husky.sh" | ||
|
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,4 @@ | ||
#!/bin/sh | ||
. "$(dirname "$0")/_/husky.sh" | ||
|
||
npx lint-staged | ||
yarn run lint-staged |
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,15 @@ | ||
{ | ||
"packages": ["sandpack-client", "sandpack-react"], | ||
"npmClient": "yarn", | ||
"useWorkspaces": true, | ||
"command": { | ||
"version": { | ||
"conventionalCommits": true, | ||
"message": "chore: [skip ci] bump packages" | ||
}, | ||
"publish": { | ||
"conventionalCommits": true, | ||
"message": "chore: [skip ci] bump 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
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,14 +1,21 @@ | ||
/* eslint-disable @typescript-eslint/no-var-requires */ | ||
const del = require("del"); | ||
const gulp = require("gulp"); | ||
const removeSourcemaps = require("gulp-remove-sourcemaps"); | ||
|
||
gulp.task("copy-sandbox", () => | ||
const dist = "./sandpack/"; | ||
const paths = process.env.CI | ||
? ["../../bundler/www/**/!(*.map)", "!../../bundler/www/public/**"] | ||
: [ | ||
"../../codesandbox-client/www/**/!(*.map)", | ||
"!../../codesandbox-client/www/public/**", | ||
]; | ||
|
||
const remove = () => del(dist); | ||
const copyFolder = () => | ||
gulp | ||
.src([ | ||
"../../codesandbox-client/www/**/*.*", | ||
"!../../codesandbox-client/www/**/*.map", | ||
"!../../codesandbox-client/www/stats.json", | ||
"!../../codesandbox-client/www/public/**/*.*", | ||
]) | ||
.src(paths, { matchBase: true }) | ||
.pipe(removeSourcemaps()) | ||
.pipe(gulp.dest("./sandpack/")) | ||
); | ||
.pipe(gulp.dest(dist)); | ||
|
||
exports["default"] = gulp.series(remove, copyFolder); |
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
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
Oops, something went wrong.
4bf1cc4
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs: