Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(ci): add prebuilt branches to allow use of unreleased features #1737

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions .github/workflows/update-prebuilt-branches.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Update Prebuilt Branches
on:
push:
branches: main
permissions:
contents: write
concurrency:
group: update-prebuilt-branches
cancel-in-progress: true
jobs:
update-prebuilt-branches:
name: Update Prebuilt Branches
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version-file: '.nvmrc'
- name: Install Dependencies
run: npm ci
- name: Disable Docs Builds
run: node ./scripts/clear-npm-script.js _build:demo _build:storybook
- name: Build
run: npm run build
- name: Update Prebuilt Branches
run: ./scripts/update-prebuilt-branches.sh
11 changes: 11 additions & 0 deletions docs/INSTALLATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,14 @@
})
export class AppModule { }
```

## Using the "Bleeding Edge" of the `main` Branch

You can install unreleased builds of the `@clr/ui` and `@clr/angular` packages by installing our prebuilt branches.
These branches are automatically built after each commit to the `main` branch, so you can use features before we release
to npm.

```bash
npm install @clr/ui@github:ng-clarity/ng-clarity.git#main-prebuilt-clr-ui
npm install @clr/angular@github:ng-clarity/ng-clarity.git#main-prebuilt-clr-angular
```
35 changes: 35 additions & 0 deletions scripts/update-prebuilt-branches.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
COMMIT_SHA=$(git log -1 --format='%H')

# configure git
git config user.name "Clarity Update Bot"
git config user.email "noreply@github.com"

# fetch prebuilt branch remotes
git fetch origin main-prebuilt-clr-ui
git fetch origin main-prebuilt-clr-angular

# add worktrees
git worktree add --track -b main-prebuilt-clr-ui main-prebuilt-clr-ui origin/main-prebuilt-clr-ui
git worktree add --track -b main-prebuilt-clr-angular main-prebuilt-clr-angular origin/main-prebuilt-clr-angular

# delete old files
rm -rf ./main-prebuilt-clr-ui/*
rm -rf ./main-prebuilt-clr-angular/*

# copy new files
cp -r ./dist/clr-ui/* ./main-prebuilt-clr-ui
cp -r ./dist/clr-angular/* ./main-prebuilt-clr-angular

# push @clr/ui
pushd ./main-prebuilt-clr-ui
git add .
git commit -m "update build for commit $COMMIT_SHA"
git push origin main-prebuilt-clr-ui:main-prebuilt-clr-ui
popd

# push @clr/angular
pushd ./main-prebuilt-clr-angular
git add .
git commit -m "update build for commit $COMMIT_SHA"
git push origin main-prebuilt-clr-angular:main-prebuilt-clr-angular
popd