diff --git a/.changeset/standard-bun-workflows.md b/.changeset/standard-bun-workflows.md new file mode 100644 index 0000000..d363b43 --- /dev/null +++ b/.changeset/standard-bun-workflows.md @@ -0,0 +1,5 @@ +--- +'@ankhorage/devtools': patch +--- + +Standardize CI/release workflow files and update the Bun tooling baseline. diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..e540a4c --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,77 @@ +name: CI + +on: + pull_request: + push: + branches: + - main + +permissions: + contents: read + +jobs: + validate: + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Setup Bun + uses: oven-sh/setup-bun@v2 + with: + bun-version: '1.3.13' + + - name: Install dependencies + run: bun install --frozen-lockfile + + - name: Run build + run: | + if node -e "const p=require('./package.json'); process.exit(p.scripts?.build ? 0 : 1)"; then + bun run build + else + echo "No build script found; skipping." + fi + + - name: Run lint + run: | + if node -e "const p=require('./package.json'); process.exit(p.scripts?.lint ? 0 : 1)"; then + bun run lint + else + echo "No lint script found; skipping." + fi + + - name: Run format check + run: | + if node -e "const p=require('./package.json'); process.exit(p.scripts?.['format:check'] ? 0 : 1)"; then + bun run format:check + else + echo "No format:check script found; skipping." + fi + + - name: Run tests + run: | + if node -e "const p=require('./package.json'); process.exit(p.scripts?.test ? 0 : 1)"; then + bun run test + else + echo "No test script found; skipping." + fi + + - name: Run typecheck + run: | + if node -e "const p=require('./package.json'); process.exit(p.scripts?.typecheck ? 0 : 1)"; then + bun run typecheck + else + echo "No typecheck script found; skipping." + fi + + - name: Check changesets + if: github.event_name == 'pull_request' + run: | + if [ -f ./scripts/check-changeset-status.sh ]; then + bash ./scripts/check-changeset-status.sh + else + echo "No changeset status script found; skipping." + fi diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..71e5870 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,65 @@ +name: Release + +on: + push: + branches: + - main + +permissions: + contents: write + pull-requests: write + id-token: write + +concurrency: + group: release-${{ github.ref }} + cancel-in-progress: false + +jobs: + release: + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Setup Bun + uses: oven-sh/setup-bun@v2 + with: + bun-version: '1.3.13' + + - name: Setup Node for npm publishing + uses: actions/setup-node@v4 + with: + node-version: 24 + registry-url: https://registry.npmjs.org + + - name: Update npm + run: npm install -g npm@latest + + - name: Install dependencies + run: bun install --frozen-lockfile + + - name: Build package + run: | + if node -e "const p=require('./package.json'); process.exit(p.scripts?.build ? 0 : 1)"; then + bun run build + else + echo "No build script found; skipping." + fi + + - name: Create release pull request or publish to npm + if: hashFiles('.changeset/config.json') != '' + uses: changesets/action@v1 + with: + version: bun run version-packages + publish: bunx changeset publish + commit: Version Packages + title: Version Packages + env: + GITHUB_TOKEN: ${{ github.token }} + + - name: Skip release + if: hashFiles('.changeset/config.json') == '' + run: echo "No Changesets config found; skipping release." diff --git a/package.json b/package.json index 565738f..5d13533 100644 --- a/package.json +++ b/package.json @@ -2,6 +2,14 @@ "name": "@ankhorage/devtools", "version": "1.0.1", "description": "Shared Lint and Format Configuration for Ankhorage", + "homepage": "https://github.com/ankhorage/devtools#readme", + "bugs": { + "url": "https://github.com/ankhorage/devtools/issues" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/ankhorage/devtools.git" + }, "type": "module", "publishConfig": { "access": "public" @@ -26,7 +34,8 @@ "lint": "eslint .", "format": "prettier --write .", "format:check": "prettier --check .", - "test": "bun test" + "test": "bun test", + "version-packages": "changeset version" }, "dependencies": { "@eslint/js": "^10.0.1", @@ -41,8 +50,9 @@ }, "devDependencies": { "@changesets/cli": "^2.30.0", + "@types/bun": "^1.3.13", "@types/node": "^25.2.3", - "bun-types": "^1.3.11", "typescript": "^5.9.3" - } + }, + "packageManager": "bun@1.3.13" } diff --git a/tsconfig.json b/tsconfig.json index 5f05acf..196c29d 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -10,7 +10,7 @@ "esModuleInterop": true, "skipLibCheck": true, "forceConsistentCasingInFileNames": true, - "types": ["bun-types"] + "types": ["bun"] }, "include": ["src/**/*"], "exclude": ["src/**/*.test.ts"]