Skip to content

Commit

Permalink
new: Setup yarn release flow for packages. (#86)
Browse files Browse the repository at this point in the history
* Update types.

* Setup workflow.

* Add script.

* Add bump.

* Move files.

* Stuff.

* Start on script.

* Add diffing.

* Add git support.

* Release
- @moonrepo/[email protected]
- @moonrepo/[email protected]
- @moonrepo/[email protected]
- @moonrepo/[email protected]
- @moonrepo/[email protected]
- @moonrepo/[email protected]

* Add bash scripts.

* Add release flow.

* Fix build.

* Test flow.

* Fix paths.

* Comment out.
  • Loading branch information
milesj authored Apr 15, 2022
1 parent 3ed7bd4 commit 01b80e1
Show file tree
Hide file tree
Showing 26 changed files with 1,760 additions and 907 deletions.
21 changes: 14 additions & 7 deletions .github/workflows/node.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,25 @@
name: Node
on:
push:
branches:
- master
pull_request:
jobs:
pack:
name: Pack
build:
name: Build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
cache: yarn
- run: yarn install --immutable
- run: yarn run pack
- run: yarn config get cacheFolder
- run: yarn run build
version:
name: Version
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-node@v3
with:
cache: yarn
- run: yarn version check
31 changes: 31 additions & 0 deletions .github/workflows/release-npm.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Release

on:
push:
# Release packages when a tag is created
tags:
- '@moonrepo/*'

jobs:
publish:
name: Publish
runs-on: ubuntu-latest
env:
NPM_CHANNEL: latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
cache: yarn
check-latest: true
node-version: 16
- name: Install dependencies
run: yarn install
- name: Build packages
run: yarn run build
- name: Publish npm packages
run: bash ./scripts/release/publishPackages.sh
shell: bash
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
16 changes: 8 additions & 8 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ on:
# Test on master to ensure PRs are good
branches:
- master
# Release packages when a tag is created
# Release cli/core packages when a tag is created
tags:
- v*
- '@moonrepo/cli@*'
schedule:
# Test every night to ensure builds are good
- cron: '0 10 * * *' # 2am PT, 10am UTC
Expand Down Expand Up @@ -79,7 +79,7 @@ jobs:
- name: Add target
run: rustup target add ${{ matrix.target }}
- name: Build binary
run: node ./scripts/buildBinary.mjs
run: node ./scripts/release/buildBinary.mjs
shell: bash
env:
BINARY: ${{ matrix.binary }}
Expand Down Expand Up @@ -124,21 +124,21 @@ jobs:
with:
path: artifacts
- name: Sync artifact binaries
run: node ./scripts/syncArtifacts.mjs
run: node ./scripts/release/syncArtifacts.mjs
shell: bash
- name: Install dependencies
run: yarn install
- name: List packages
run: ls -R ./packages/core-linux-* ./packages/core-macos-* ./packages/core-windows-*
shell: bash
- name: Test binary
run: node ./scripts/testBinary.mjs
run: node ./scripts/release/testBinary.mjs
shell: bash
env:
TARGET: ${{ matrix.target }}

publish:
if: ${{ startsWith(github.ref, 'refs/tags/v') }}
if: ${{ startsWith(github.ref, 'refs/tags/@moonrepo/cli') }}
name: Publish
runs-on: ubuntu-latest
needs:
Expand All @@ -159,13 +159,13 @@ jobs:
with:
path: artifacts
- name: Sync artifact binaries
run: node ./scripts/syncArtifacts.mjs
run: node ./scripts/release/syncArtifacts.mjs
shell: bash
- name: List binaries
run: ls -R artifacts
shell: bash
- name: Publish npm packages
run: bash ./scripts/publishPackages.sh
run: bash ./scripts/release/publishBinaryPackages.sh
shell: bash
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand Down
2 changes: 2 additions & 0 deletions .moon/project.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ tasks:
outputs:
- 'dts'
- 'mjs'
env:
NODE_ENV: production

format:
command: 'prettier'
Expand Down
550 changes: 550 additions & 0 deletions .yarn/plugins/@yarnpkg/plugin-version.cjs

Large diffs are not rendered by default.

28 changes: 28 additions & 0 deletions .yarn/plugins/@yarnpkg/plugin-workspace-tools.cjs

Large diffs are not rendered by default.

13 changes: 12 additions & 1 deletion .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
changesetIgnorePatterns:
- '**/dts/**/*'
- '**/lib/**/*'
- '**/mjs/**/*'
- '**/*.test.{js,ts,tsx}'
- '**/*.{md,mdx}'

enableGlobalCache: true

enableTelemetry: false
Expand All @@ -6,6 +13,10 @@ nodeLinker: node-modules

plugins:
- path: .yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs
spec: "@yarnpkg/plugin-interactive-tools"
spec: '@yarnpkg/plugin-interactive-tools'
- path: .yarn/plugins/@yarnpkg/plugin-version.cjs
spec: '@yarnpkg/plugin-version'
- path: .yarn/plugins/@yarnpkg/plugin-workspace-tools.cjs
spec: '@yarnpkg/plugin-workspace-tools'

yarnPath: .yarn/releases/yarn-3.2.0.cjs
29 changes: 14 additions & 15 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,12 @@
"private": true,
"packageManager": "[email protected]",
"scripts": {
"build": "packemon build --addEngines --addExports",
"pack": "NODE_ENV=production yarn run packemon pack --addEngines --declaration=standard",
"format": "prettier --write ./packages",
"test": "jest --passWithNoTests",
"lint": "eslint --cache --color --fix --ext .ts,.tsx,.mjs ./packages ./scripts",
"type": "tsc --build",
"cli": "target/debug/moon"
"version:apply": "node ./scripts/version/applyAndTagVersions.mjs",
"version:bump": "yarn version check --interactive",
"version:bump:bin": "bash ./scripts/version/bumpBinaryVersions.sh",
"build": "NODE_ENV=production packemon pack --addEngines --addExports --declaration=standard",
"type": "target/debug/moon --logLevel trace run :typecheck",
"moon": "target/debug/moon --logLevel trace"
},
"workspaces": [
"packages/*"
Expand All @@ -19,15 +18,15 @@
},
"devDependencies": {
"@moonrepo/cli": "workspace:*",
"@types/node": "^17.0.15",
"eslint": "^8.8.0",
"eslint-config-beemo": "^1.2.2",
"jest": "^27.4.7",
"jest-preset-beemo": "^1.1.5",
"packemon": "^1.11.1",
"prettier": "^2.5.1",
"@types/node": "^17.0.24",
"eslint": "^8.13.0",
"eslint-config-beemo": "^1.2.8",
"jest": "^27.5.1",
"jest-preset-beemo": "^1.1.7",
"packemon": "^1.15.0",
"prettier": "^2.6.2",
"prettier-config-beemo": "^1.0.1",
"tsconfig-beemo": "^1.0.1",
"typescript": "^4.5.5"
"typescript": "^4.6.3"
}
}
10 changes: 5 additions & 5 deletions packages/cli/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@moonrepo/cli",
"version": "0.0.1",
"version": "0.0.2",
"description": "Moon command line and core system.",
"keywords": [
"moon",
Expand Down Expand Up @@ -33,10 +33,10 @@
"detect-libc": "^2.0.1"
},
"optionalDependencies": {
"@moonrepo/core-linux-x64-gnu": "^0.0.1",
"@moonrepo/core-linux-x64-musl": "^0.0.1",
"@moonrepo/core-macos-x64": "^0.0.1",
"@moonrepo/core-windows-x64-msvc": "^0.0.1"
"@moonrepo/core-linux-x64-gnu": "^0.0.2",
"@moonrepo/core-linux-x64-musl": "^0.0.2",
"@moonrepo/core-macos-x64": "^0.0.2",
"@moonrepo/core-windows-x64-msvc": "^0.0.2"
},
"engines": {
"node": ">=12.17.0"
Expand Down
2 changes: 1 addition & 1 deletion packages/core-linux-x64-gnu/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@moonrepo/core-linux-x64-gnu",
"version": "0.0.1",
"version": "0.0.2",
"description": "Linux binary for Moon.",
"keywords": [
"moon",
Expand Down
2 changes: 1 addition & 1 deletion packages/core-linux-x64-musl/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@moonrepo/core-linux-x64-musl",
"version": "0.0.1",
"version": "0.0.2",
"description": "Linux binary for Moon.",
"keywords": [
"moon",
Expand Down
2 changes: 1 addition & 1 deletion packages/core-macos-x64/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@moonrepo/core-macos-x64",
"version": "0.0.1",
"version": "0.0.2",
"description": "MacOS binary for Moon.",
"keywords": [
"moon",
Expand Down
2 changes: 1 addition & 1 deletion packages/core-windows-x64-msvc/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@moonrepo/core-windows-x64-msvc",
"version": "0.0.1",
"version": "0.0.2",
"description": "Windows binary for Moon.",
"keywords": [
"moon",
Expand Down
10 changes: 7 additions & 3 deletions packages/runtime/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"name": "@moonrepo/runtime",
"version": "0.0.1",
"version": "0.0.2",
"type": "module",
"description": "Action runner and runtime utilities.",
"keywords": [
"moon",
Expand All @@ -11,7 +12,6 @@
],
"author": "Miles Johnson",
"license": "MIT",
"type": "module",
"main": "./mjs/index.mjs",
"module": "./mjs/index.mjs",
"types": "./dts/index.d.ts",
Expand Down Expand Up @@ -39,10 +39,14 @@
},
"exports": {
"./package.json": "./package.json",
"./*": {
"types": "./dts/*.d.ts"
},
".": {
"node": {
"import": "./mjs/index.mjs"
}
},
"types": "./dts/index.d.ts"
}
}
}
46 changes: 36 additions & 10 deletions packages/runtime/src/types.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,45 @@
import { PackageStructure, Path } from '@boost/common';
import { Path } from '@boost/common';

export interface TsConfigStructure {
compilerOptions?: Record<string, unknown>;
exclude?: string[];
extends?: string;
files?: string[];
include?: string[];
references?: { path: string }[];
export interface FileGroup {
files: string;
id: string;
}

// Keep in sync with crates/project/src/task.rs
export type TaskMergeStrategy = 'append' | 'prepend' | 'replace';

export interface TaskOptions {
mergeArgs: TaskMergeStrategy;
mergeDeps: TaskMergeStrategy;
mergeEnv: TaskMergeStrategy;
mergeInputs: TaskMergeStrategy;
mergeOutputs: TaskMergeStrategy;
retryCount: number;
runInCI: boolean;
runFromWorkspaceRoot: boolean;
}

export interface Task {
args: string[];
command: string;
deps: string[];
env: Record<string, string>;
inputs: string[];
inputGlobs: string[];
inputPaths: string[];
options: TaskOptions;
outputs: string[];
outputPaths: string[];
target: string;
type: 'node' | 'system';
}

// Keep in sync with crates/project/src/project.rs
export interface Project {
config: object;
fileGroups: Record<string, FileGroup>;
id: string;
package_json: PackageStructure | null;
root: Path;
source: string;
tsconfig_json: TsConfigStructure | null;
tasks: Record<string, Task>;
}
38 changes: 0 additions & 38 deletions scripts/buildBinary.mjs

This file was deleted.

Loading

0 comments on commit 01b80e1

Please sign in to comment.