Skip to content

Instantly share code, notes, and snippets.

@itsdouges
Last active May 29, 2023 03:32
Show Gist options
  • Save itsdouges/40b9b17d99378d03851cd1cb96b772c3 to your computer and use it in GitHub Desktop.
Save itsdouges/40b9b17d99378d03851cd1cb96b772c3 to your computer and use it in GitHub Desktop.
How to get Shipit sync working https://github.com/adeira/shipit
# Run this when wanting to import a pr into your repo
# You run it locally from your main branch and then it'll check out a branch locally and sync the commit keeping author/email.
# You then push up and merge whenever then it'll sync to your public repo.
npx monorepo-importit --committer-name=A --committer-email=B --pull-request=https://github.com/adeira/js/pull/1
// .shipit/triplex.js
module.exports = {
getStaticConfig() {
return {
repository: "[email protected]:try-triplex/triplex.git", // <-- where your public repo is. I created multiple and pushed multiple times to test locally. Then deleted and started over.
};
},
getPathMappings() { // <-- what roots you want to expose. You can re-write them to other locations. Only folders allowed.
return new Map([
[".changeset", ".changeset"],
[".tsconfig", ".tsconfig"],
[".vscode", ".vscode"],
["apps/docs", "apps/docs"],
["examples", "examples"],
["packages/bridge", "packages/bridge"],
["packages/create-triplex-project", "packages/create-triplex-project"],
["packages/editor", "packages/editor"],
["packages/react-three-test", "packages/react-three-test"],
["packages/run", "packages/run"],
["packages/scene", "packages/scene"],
["oss-roots/triplex/", ""], // <- e.g. I have a oss-root that has duplicate readmes/configs/lock files
]);
},
getStrippedFiles() {
return new Set([/^.github\/workflows\/(electron|shipit|release)/]); // <-- Exclude anything you don't want that's found in the above folders
},
getBranchConfig() {
return {
source: "origin/main", // <-- define the source/dest branches. chance source to your local when testing if you want.
destination: "main",
};
},
};
# Run locally when testing
npx monorepo-shipit --committer-name triplex-bot --committer-email [email protected]
name: Shipit
on:
push:
branches:
- main
env:
CI: true
PNPM_CACHE_FOLDER: .pnpm-store
jobs:
publish:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@master
with:
# Shipit requires all history.
fetch-depth: 0
- name: Read node version
run: echo "NVMRC=$(cat .nvmrc)" >> $GITHUB_OUTPUT
id: nvm
- name: Setup pnpm
uses: pnpm/action-setup@v2
with:
version: 7.28.0
- name: Setup node
uses: actions/setup-node@v3
with:
node-version: ${{ steps.nvm.outputs.NVMRC }}
cache: "pnpm"
- name: Setup pnpm config
run: pnpm config set store-dir $PNPM_CACHE_FOLDER
- name: Install dependencies
run: pnpm i
- name: Prepare Shipit
run: |
mkdir -p ~/.ssh
echo "${{ secrets.SSH_SHIPIT_PRIVATE_KEY }}" | tr -d '\r' > ~/.ssh/id_rsa
chmod 600 ~/.ssh/id_rsa
ssh-keyscan -H 'github.com' >> ~/.ssh/known_hosts
- name: Run Shipit
run:
npx monorepo-shipit --committer-name triplex-bot --committer-email
[email protected]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment