Skip to content

Commit

Permalink
fix: deploy action, publish tags on release, and revert coordinator base
Browse files Browse the repository at this point in the history
  • Loading branch information
bucko13 committed Feb 13, 2024
1 parent 91b0850 commit 1cf609b
Show file tree
Hide file tree
Showing 7 changed files with 66 additions and 10 deletions.
5 changes: 5 additions & 0 deletions .changeset/grumpy-flies-chew.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@caravan/coordinator": patch
---

Fix deploy and revert back to original base url for github pages compatibility
4 changes: 4 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ jobs:
strategy:
matrix:
node-version: ["20.x"]
# To use Turborepo Remote Caching
env:
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
TURBO_TEAM: ${{ vars.TURBO_TEAM }}

steps:
- name: Checkout Repo
Expand Down
29 changes: 26 additions & 3 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ name: Deploy
on:
push:
tags:
- '@caravan/coordinator@*'
- '@caravan/coordinator**'
branches:
- main

permissions:
contents: write
Expand All @@ -12,12 +14,33 @@ jobs:
deploy:
name: Deploy
runs-on: ubuntu-latest
# To use Turborepo Remote Caching
env:
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
TURBO_TEAM: ${{ vars.TURBO_TEAM }}

steps:
- name: Checkout Repo
uses: actions/checkout@v3

- name: Setup Node.js 20
uses: actions/setup-node@v3
with:
node-version: 20

- name: Install dependencies
run: npm install

- name: Deploy
run: npx turbo run deploy
# the deploy action can't find the build directory if it's in the
# sub directory of the monorepo, even if we reference it correctly
# so we have to copy it to the root of the repo.
- name: Build
run: |
npx turbo run build
cp -R apps/coordinator ./build
- name: Deploy to GitHub Pages
uses: JamesIves/github-pages-deploy-action@v4
with:
branch: gh-pages
folder: build
15 changes: 15 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@ jobs:
release:
name: Release
runs-on: ubuntu-latest
# To use Turborepo Remote Caching
env:
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
TURBO_TEAM: ${{ vars.TURBO_TEAM }}

steps:
- name: Checkout Repo
uses: actions/checkout@v3
Expand Down Expand Up @@ -45,3 +50,13 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

# For caravan coordinator, there's no publish to npm so no
# tag is created. This makes sure we push tags for everything
- name: Publish tags
if: steps.changesets.outputs.published == 'true'
run: |
npm run publish-tags
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

10 changes: 5 additions & 5 deletions apps/coordinator/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ addresses.
Caravan is also stateless. It does not itself store any data. You must
safekeep the addresses (and redeem scripts & BIP32 paths) you create.

[Try Caravan now!](https://caravan-bitcoin.github.io/coordinator)
[Try Caravan now!](https://caravan-bitcoin.github.io/caravan)

## Installation

Expand All @@ -20,7 +20,7 @@ be run in any web browser from a local or remote installation.
### Unchained Capital GitHub

The simplest way to use Caravan is to visit
[https://caravan-bitcoin.github.io/coordinator](https://caravan-bitcoin.github.io/coordinator),
[https://caravan-bitcoin.github.io/caravan](https://caravan-bitcoin.github.io/caravan),
a copy of Caravan hosted on GitHub by
[Unchained Capital](https://www.unchained.com).

Expand All @@ -43,7 +43,7 @@ $ turbo run deploy
```

You should see a copy of the Caravan web application at
`https://YOUR_GITHUB_USERNAME.github.io/coordinator`. If not, go back to the
`https://YOUR_GITHUB_USERNAME.github.io/caravan`. If not, go back to the
GitHub Pages section and ensure you see a message
saying "Your site is published at ...".

Expand All @@ -62,7 +62,7 @@ $ npm run dev
...
```

Now visit http://localhost:5173/coordinator/# to interact with your local copy of
Now visit http://localhost:5173/caravan/# to interact with your local copy of
Caravan.

### Host Remotely
Expand Down Expand Up @@ -105,7 +105,7 @@ Caravan should then be accessible at http://localhost:8000/caravan/#
## Usage

If you can access the [Caravan Coordinator web
application](https://caravan-bitcoin.github.io/coordinator) in your
application](https://caravan-bitcoin.github.io/caravan) in your
browser, you are ready to start using Caravan.

Click the _Create_ or _Interact_ links in the navbar to get started.
Expand Down
10 changes: 9 additions & 1 deletion apps/coordinator/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import path from "path";

// https://vitejs.dev/config/
export default defineConfig({
base: "/coordinator/#",
base: "/caravan/#",
resolve: {
alias: {
utils: path.resolve(__dirname, "./src/utils"),
Expand All @@ -19,6 +19,14 @@ export default defineConfig({
],
build: {
outDir: "build",
rollupOptions: {
onwarn(warning, warn) {
if (warning.code === "MODULE_LEVEL_DIRECTIVE") {
return;
}
warn(warning);
},
},
},
define: {
__GIT_SHA__: JSON.stringify(process.env.__GIT_SHA__),
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
"gen": "turbo gen run",
"lint": "turbo lint",
"version": "turbo run build lint test && changeset version",
"release": "turbo run build lint test && changeset publish"
"release": "turbo run build lint test && changeset publish",
"publish-tags": "changeset tag && git push --follow-tags"
},
"devDependencies": {
"@caravan/eslint-config": "*",
Expand Down

0 comments on commit 1cf609b

Please sign in to comment.