Skip to content

Commit

Permalink
Set up CI and automated publishing (#2)
Browse files Browse the repository at this point in the history
* Set up CI and automated publishing

* Add README.md

* Tweak comment
  • Loading branch information
nwalters512 authored Jun 17, 2024
1 parent fd37afb commit 953e36e
Show file tree
Hide file tree
Showing 6 changed files with 2,072 additions and 12 deletions.
8 changes: 8 additions & 0 deletions .changeset/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"$schema": "https://unpkg.com/@changesets/[email protected]/schema.json",
"changelog": "@changesets/cli/changelog",
"commit": false,
"access": "public",
"baseBranch": "main",
"privatePackages": false
}
35 changes: 35 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: CI

on:
push:
branches:
- master
pull_request:
merge_group:

concurrency:
# Ensure that we only run one concurrent job for Pull Requests. This ensures
# that someone can't kill our throughput by pushing a bunch of commits to a
# single branch in rapid succession.
#
# However, for master builds, we allow maximum concurrency. This is achieved
# because `github.head_ref` isn't defined there, and `github.run_id` is
# globally unique in this repo.
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

jobs:
ci:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- uses: actions/setup-node@v4
with:
node-version: 20.x
cache: 'yarn'

- run: yarn install --immutable --inline-builds

- run: yarn build
43 changes: 43 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Release

on:
push:
branches:
- 'main'

jobs:
release:
name: Release
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@v4
with:
# This makes Actions fetch all Git history so that Changesets can generate changelogs with the correct commits
fetch-depth: 0

- name: Setup Node.js 20.x
uses: actions/setup-node@v4
with:
node-version: 20.x
cache: 'yarn'

- name: Install Dependencies
run: yarn --immutable

- name: Create Release Pull Request or Publish to npm
id: changesets
uses: changesets/action@v1
with:
# This invokes the `version` script in `package.json`, which will run
# `changeset version` and then `yarn`. We need to run `yarn` in order
# to update `yarn.lock`: https://github.com/changesets/action/issues/170
version: yarn version
# This invokes the `release` script in `package.json`, which will build
# the packages and then invoke `changeset publish`.
publish: yarn release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# This token was generated by Nathan Walters on 2024-06-17.
# It expires on 2030-01-01.
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
16 changes: 16 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
# excalidraw-builds

Excalidraw pre-bundled with React.

## Releasing a new version

This repository uses [Changesets](https://github.com/changesets/changesets) to automate the versioning process.

When adding changes that should be released, run the following command and follow the prompts:

```sh
yarn changeset
```

Commit the changeset file that was created and submit it with your PR.

Once the PR is merged, a versioning PR will be opened automatically, and it will stay up to date as additional PRs are merged.

Once you're ready to release a new version, merge the versioning PR and the new version will be published to npm.
16 changes: 11 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,21 @@
"description": "Excalidraw bundled with React",
"license": "MIT",
"main": "dist/index.js",
"files": ["dist"],
"files": [
"dist"
],
"repository": "[email protected]:PrairieLearn/excalidraw-builds.git",
"scripts": {
"build": "node esbuild.config.js"
"build": "node esbuild.config.js",
"release": "yarn build && changeset publish",
"version": "changeset version && yarn"
},
"devDependencies": {
"@changesets/cli": "^2.27.5",
"@excalidraw/excalidraw": "0.17.1-2f9526d",
"esbuild": "^0.21.3",
"react": "18.3.1",
"react-dom": "18.3.1",
"esbuild": "^0.21.3"
}
"react-dom": "18.3.1"
},
"packageManager": "[email protected]+sha1.1959a18351b811cdeedbd484a8f86c3cc3bbaf72"
}
Loading

0 comments on commit 953e36e

Please sign in to comment.