Skip to content

Commit

Permalink
ci: consume artifacts
Browse files Browse the repository at this point in the history
  • Loading branch information
danilowoz committed Aug 23, 2021
1 parent 784e350 commit 3f7e4b5
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 22 deletions.
14 changes: 7 additions & 7 deletions .github/workflows/checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,34 +7,34 @@ jobs:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Checkout
- name: Setup | Checkout
uses: actions/checkout@v1

- uses: actions/cache@v2
with:
path: "**/node_modules"
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}

- name: Install dependencies
- name: Setup | Install dependencies
run: yarn install --frozen-lockfile

- name: Lint
- name: Lint | Eslint
run: yarn run lint

build:
name: Build
runs-on: ubuntu-18.04
timeout-minutes: 10
steps:
- name: Checkout
- name: Setup | Checkout
uses: actions/checkout@v1

- uses: actions/cache@v2
with:
path: "**/node_modules"
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}

- name: Install dependencies
- name: Setup | Install dependencies
run: yarn install --frozen-lockfile

- name: Build
Expand All @@ -45,15 +45,15 @@ jobs:
runs-on: ubuntu-18.04
timeout-minutes: 10
steps:
- name: Checkout
- name: Setup | Checkout
uses: actions/checkout@v1

- uses: actions/cache@v2
with:
path: "**/node_modules"
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}

- name: Install dependencies
- name: Setup | Install dependencies
run: yarn install --frozen-lockfile

- name: Commitlint
Expand Down
35 changes: 26 additions & 9 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
runs-on: ubuntu-latest

steps:
- name: Clone codesandbox-client
- name: Setup | Clone codesandbox-client
uses: actions/checkout@v2
with:
repository: codesandbox/codesandbox-client
Expand All @@ -26,13 +26,13 @@ jobs:
node-version: "10.23.2"
registry-url: "https://npm.pkg.github.com/"

- name: Install dependencies
- name: Setup | Install dependencies
run: yarn

- name: Build dependencies
- name: Prepare | Build dependencies
run: yarn build:deps

- name: Build sandpack bundler
- name: Prepare | Build sandpack bundler
run: yarn build:sandpack

- name: Archive bundler artifacts
Expand All @@ -44,6 +44,9 @@ jobs:
publish:
runs-on: ubuntu-latest
needs: [bundler]
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

steps:
- name: Setup | Checkout
Expand All @@ -52,19 +55,33 @@ jobs:
# pulls all commits (needed for lerna / semantic release to correctly version)
fetch-depth: "0"

- name: Setup | Ensure registry access
run: npm whoami --registry https://npm.pkg.github.com/

- 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: Install dependencies
- name: Setup | Install dependencies
run: yarn install --frozen-lockfile

- name: Build
run: yarn run build

- name: Download artifacts
- name: Prepare | Download artifacts
uses: actions/download-artifact@v2
with:
name: bundler
path: bundler

- name: Prepare | Build
run: yarn run build:publish

# - name: Prepare | Lerna Version
# run: yarn lerna version --create-release github --yes

# - name: Release | Lerna Publish
# run: lerna publish from-package --yes
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"lint": "eslint '**/*.ts?(x)' --fix",
"format": "prettier --write '**/*.ts?(x)'",
"build": "yarn workspaces run build",
"build:publish": "yarn workspaces run build:publish",
"prepare": "husky install"
},
"repository": {
Expand Down
18 changes: 12 additions & 6 deletions sandpack-client/gulpfile.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,20 @@
const gulp = require("gulp");
const removeSourcemaps = require("gulp-remove-sourcemaps");

gulp.task("copy-sandbox", () =>
gulp
.src([
const paths = process.env.CI
? [
"../../bundler/www/**/*.*",
"!../../bundler/www/**/*.map",
"!../../bundler/www/stats.json",
"!../../bundler/www/public/**/*.*",
]
: [
"../../codesandbox-client/www/**/*.*",
"!../../codesandbox-client/www/**/*.map",
"!../../codesandbox-client/www/stats.json",
"!../../codesandbox-client/www/public/**/*.*",
])
.pipe(removeSourcemaps())
.pipe(gulp.dest("./sandpack/"))
];

gulp.task("copy-sandbox", () =>
gulp.src(paths).pipe(removeSourcemaps()).pipe(gulp.dest("./sandpack/"))
);
1 change: 1 addition & 0 deletions sandpack-react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
"scripts": {
"prebuild": "rimraf dist",
"build": "yarn build:cjs && yarn build:esm && yarn build:css",
"build:publish": "yarn build:cjs && yarn build:esm && yarn build:css",
"build:cjs": "tsc -p tsconfig.cjs.json",
"build:esm": "tsc -p tsconfig.esm.json",
"build:css": "postcss src/styles/index.css -o dist/index.css -u autoprefixer -u cssnano",
Expand Down

0 comments on commit 3f7e4b5

Please sign in to comment.