Trigger build #60
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
on: | |
push: | |
# branches: | |
# - main | |
jobs: | |
test: | |
name: Run tests | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: oven-sh/setup-bun@v1 | |
with: | |
bun-version: latest | |
- name: Install dependencies | |
run: bun install | |
- name: 🔍 Run type checking | |
run: bun run typecheck | |
# - name: 🚨 Run linting | |
# run: bun run lint | |
- name: 🧪 Run unit tests | |
run: bun run test | |
publish-cli: | |
name: Publish CLI | |
if: contains(github.event.head_commit.modified, 'packages/cli/') | |
needs: [test] | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
packages: write | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: oven-sh/setup-bun@v1 | |
with: | |
bun-version: latest | |
- name: Install dependencies | |
run: bun install | |
- name: Build | |
run: bun run build | |
- name: Get version | |
id: get_version | |
run: | | |
CURRENT_VERSION=$(node -p "require('./packages/cli/package.json').version") | |
echo "version=${CURRENT_VERSION}" >> $GITHUB_OUTPUT | |
echo "new_version=$(npx semver ${CURRENT_VERSION} -i patch)" >> $GITHUB_OUTPUT | |
- name: Update version | |
run: | | |
cd packages/cli | |
npm version ${{ steps.get_version.outputs.new_version }} --no-git-tag-version | |
- name: Create Release | |
uses: softprops/action-gh-release@v1 | |
with: | |
tag_name: v${{ steps.get_version.outputs.new_version }} | |
name: Release v${{ steps.get_version.outputs.new_version }} | |
generate_release_notes: true | |
- name: Setup NPM Auth | |
run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > ~/.npmrc | |
- name: Publish to NPM | |
run: cd packages/cli && npm publish --access public | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |