diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6745ba9..2fc33ae 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,11 +1,18 @@ name: CI Build on: + # Runs on pushes targeting the default branch push: branches: - - main + - "**" + # - main + # - master + # - trunk + tags: + - "!**" + # Run every time a PR is updated pull_request: - branches: - - main + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: jobs: test: runs-on: ${{ matrix.os }} @@ -25,7 +32,7 @@ jobs: - id: install-deps name: Install dependencies run: | - bun install + bun install --frozen-lockfile - id: test name: Run tests run: | diff --git a/.github/workflows/commit-lint.yml b/.github/workflows/commit-lint.yml new file mode 100644 index 0000000..eea6f22 --- /dev/null +++ b/.github/workflows/commit-lint.yml @@ -0,0 +1,19 @@ +name: Commit Lint +on: + pull_request: + branches: + - main + - master + - trunk +jobs: + conventions: + name: Conventional Commits + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + name: Checkout Code + - uses: webiny/action-conventional-commits@v1.3.0 + name: Validate Commits + # optional, required for private repos: + # with: + # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/.github/workflows/publish-npm.yml b/.github/workflows/publish-npm.yml new file mode 100644 index 0000000..9f1347c --- /dev/null +++ b/.github/workflows/publish-npm.yml @@ -0,0 +1,32 @@ +name: Publish Package to npmjs +on: + release: + types: [published] +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + # Setup .npmrc file to publish to npm + - uses: actions/setup-node@v4 + with: + node-version: '18.x' + registry-url: 'https://registry.npmjs.org' + - id: setup-bun + name: Setup Bun + uses: oven-sh/setup-bun@v1 + with: + bun-version: latest + - id: install-deps + name: Install dependencies + run: | + bun install --frozen-lockfile + - id: build + name: Build library + run: | + bun run build + - run: npm publish + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} \ No newline at end of file