Skip to content

Commit

Permalink
chore(main): convert to monorepo
Browse files Browse the repository at this point in the history
  • Loading branch information
treyturner committed Oct 4, 2024
1 parent 162c834 commit 2b56e8d
Show file tree
Hide file tree
Showing 48 changed files with 421 additions and 305 deletions.
59 changes: 59 additions & 0 deletions .github/workflows/build-test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: Build & Test

on:
workflow_call:
pull_request:

concurrency:
group: ${{ github.event.pull_request.number || github.ref || github.sha }}
cancel-in-progress: true

jobs:
check-and-test:
name: check-and-test-${{ matrix.package }}
runs-on: ubuntu-latest
strategy:
matrix:
package: ${{ fromJson(vars.PACKAGES) }}
defaults:
run:
working-directory: packages/${{ matrix.package }}
env:
ARTIFACTS_API_TOKEN: ${{ secrets.ARTIFACTS_API_TOKEN }}
ARTIFACTS_USERNAME: ${{ secrets.ARTIFACTS_USERNAME }}
ARTIFACTS_PASSWORD: ${{ secrets.ARTIFACTS_PASSWORD }}
ARTIFACTS_CHARACTER: ${{ secrets.ARTIFACTS_CHARACTER }}
steps:
- uses: actions/checkout@v4
- uses: oven-sh/setup-bun@v2
with:
bun-version-file: ".bun-version"
- run: bun install --frozen-lockfile
- run: bun check
- run: bun test

build:
name: build-${{ matrix.package }}
runs-on: ubuntu-latest
strategy:
matrix:
package: ${{ fromJson(vars.PACKAGES) }}
defaults:
run:
working-directory: packages/${{ matrix.package }}
permissions:
contents: read
id-token: write
steps:
- uses: actions/checkout@v4
- uses: oven-sh/setup-bun@v2
with:
bun-version-file: ".bun-version"
- run: bun install --frozen-lockfile
- run: bun run build
- uses: actions/upload-artifact@v4
with:
name: ${{ matrix.package }}-dist
path: packages/${{ matrix.package }}/dist
compression-level: 9
retention-days: 7
67 changes: 67 additions & 0 deletions .github/workflows/release-publish.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
name: Release & Publish

on:
workflow_dispatch:
# push:
# branches:
# - main

jobs:
build-and-test:
uses: ./.github/workflows/build-test.yaml
secrets: inherit
permissions:
contents: read
id-token: write

release-please:
runs-on: ubuntu-latest
needs: [build-and-test]
steps:
- uses: googleapis/release-please-action@v4
id: release
with:
token: ${{ secrets.RELEASE_PLEASE_TOKEN }}
- uses: actions/github-script@v7
id: get-packages-released
env:
PATHS_RELEASED: ${{ steps.release.outputs.paths_released }}
with:
script: |
const paths = JSON.parse(process.env.PATHS_RELEASED);
const result = paths.map(path => path.split('/')[1]);
return result;
outputs:
packages-released: ${{ steps.get-packages-released.outputs.result }}

publish:
if: ${{ needs.release-please.outputs.packages-released != '[]' }}
runs-on: ubuntu-latest
needs: [release-please]
strategy:
matrix:
package: ${{ fromJson(needs.release-please.outputs.packages-released) }}
defaults:
run:
working-directory: packages/${{ matrix.package }}
permissions:
contents: read
id-token: write
steps:
- uses: actions/checkout@v4
- uses: oven-sh/setup-bun@v2
with:
bun-version-file: ".bun-version"
- run: bun install --frozen-lockfile
- uses: actions/setup-node@v4
with:
node-version: '20.x'
registry-url: 'https://registry.npmjs.org'
- uses: actions/download-artifact@v4
with:
name: ${{ matrix.package }}-dist
path: packages/${{ matrix.package }}/dist
- name: publish ${{ matrix.package }}
run: npm publish --provenance --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
39 changes: 0 additions & 39 deletions .github/workflows/release.yaml

This file was deleted.

28 changes: 0 additions & 28 deletions .github/workflows/test.yaml

This file was deleted.

2 changes: 1 addition & 1 deletion .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
#!/usr/bin/env sh
bunx --no -- commitlint --edit $1
bunx --bun -- commitlint --edit $1
3 changes: 3 additions & 0 deletions .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"packages/api-client": "1.0.11"
}
Loading

0 comments on commit 2b56e8d

Please sign in to comment.