Make authorizationUrl and launch exclusive #58
Workflow file for this run
This file contains hidden or 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
| name: CI/CD | |
| on: | |
| push: | |
| branches: [main] | |
| tags: ["v*"] | |
| pull_request: | |
| branches: [main] | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| jobs: | |
| test: | |
| name: Test (Bun on ${{ matrix.os }}) | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ubuntu-latest, macos-latest] | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: oven-sh/setup-bun@v2 | |
| with: | |
| bun-version: latest | |
| - uses: actions/cache@v5 | |
| with: | |
| path: ~/.bun/install/cache | |
| key: ${{ runner.os }}-bun-${{ hashFiles('**/bun.lock') }} | |
| restore-keys: | | |
| ${{ runner.os }}-bun- | |
| - run: bun install --frozen-lockfile | |
| - run: bun run build:templates | |
| - run: bun test | |
| - run: bun run typecheck | |
| if: matrix.os == 'ubuntu-latest' | |
| build: | |
| name: Build & Validate | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: oven-sh/setup-bun@v2 | |
| with: | |
| bun-version: latest | |
| - uses: actions/cache@v5 | |
| with: | |
| path: ~/.bun/install/cache | |
| key: ${{ runner.os }}-bun-${{ hashFiles('**/bun.lock') }} | |
| restore-keys: | | |
| ${{ runner.os }}-bun- | |
| - run: bun install --frozen-lockfile | |
| - run: bun run format:check | |
| - run: bun run typecheck | |
| - run: bun run build:templates | |
| - run: bun run build | |
| - run: bun run lint:package | |
| - name: Check dist output | |
| run: | | |
| if [ ! -f "dist/index.js" ]; then | |
| echo "Error: dist/index.js not found" | |
| exit 1 | |
| fi | |
| if [ ! -f "dist/index.d.ts" ]; then | |
| echo "Error: dist/index.d.ts not found" | |
| exit 1 | |
| fi | |
| echo "✅ Build output verified" | |
| - uses: actions/upload-artifact@v6 | |
| with: | |
| name: dist | |
| path: dist/ | |
| retention-days: 1 | |
| validate-examples: | |
| name: Validate Examples | |
| runs-on: ubuntu-latest | |
| needs: build | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: oven-sh/setup-bun@v2 | |
| with: | |
| bun-version: latest | |
| - uses: actions/cache@v5 | |
| with: | |
| path: ~/.bun/install/cache | |
| key: ${{ runner.os }}-bun-${{ hashFiles('**/bun.lock') }} | |
| restore-keys: | | |
| ${{ runner.os }}-bun- | |
| - run: bun install --frozen-lockfile | |
| - uses: actions/download-artifact@v6 | |
| with: | |
| name: dist | |
| path: dist/ | |
| - run: bun run examples/demo.ts --no-browser | |
| timeout-minutes: 1 | |
| - name: Check example files | |
| run: | | |
| for file in examples/*.ts; do | |
| echo "Checking $file..." | |
| if [[ "$file" == *"demo.ts"* ]]; then | |
| echo "✓ $file - skipping (interactive demo)" | |
| else | |
| bun build "$file" --target=node --outdir=/tmp/build-test > /dev/null && echo "✓ $file builds successfully" | |
| fi | |
| done | |
| publish: | |
| name: Publish to NPM | |
| runs-on: ubuntu-latest | |
| needs: [test, build, validate-examples] | |
| if: startsWith(github.ref, 'refs/tags/v') | |
| environment: npm | |
| permissions: | |
| contents: write | |
| id-token: write | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: actions/setup-node@v6 | |
| with: | |
| node-version: "20" | |
| registry-url: "https://registry.npmjs.org" | |
| - uses: oven-sh/setup-bun@v2 | |
| with: | |
| bun-version: latest | |
| - run: bun install --frozen-lockfile | |
| - run: | | |
| bun run build:templates | |
| bun run build | |
| - name: Verify version match | |
| run: | | |
| PACKAGE_VERSION="v$(node -p "require('./package.json').version")" | |
| TAG_VERSION="${GITHUB_REF#refs/tags/}" | |
| if [ "$PACKAGE_VERSION" != "$TAG_VERSION" ]; then | |
| echo "Error: Package version ($PACKAGE_VERSION) doesn't match tag ($TAG_VERSION)" | |
| exit 1 | |
| fi | |
| echo "✅ Version verified: $PACKAGE_VERSION" | |
| - run: npm publish --provenance --access public | |
| env: | |
| NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
| - uses: softprops/action-gh-release@v2 | |
| with: | |
| name: Release ${{ github.ref_name }} | |
| generate_release_notes: true | |
| draft: false | |
| prerelease: ${{ contains(github.ref_name, '-') }} | |
| files: | | |
| dist/**/* |