diff --git a/.github/workflows/nodejs-pgsql14.yml b/.github/workflows/nodejs-pgsql14.yml index 9f494cd..1e2ca53 100644 --- a/.github/workflows/nodejs-pgsql14.yml +++ b/.github/workflows/nodejs-pgsql14.yml @@ -49,8 +49,6 @@ jobs: npm run build - name: Test run: npm test - env: - POSTGRES_PORT: 5432 - uses: phoenix-actions/test-reporting@v8 if: success() || failure() id: test-report diff --git a/.github/workflows/nodejs-pgsql15.yml b/.github/workflows/nodejs-pgsql15.yml index 68148ee..eb5f15e 100644 --- a/.github/workflows/nodejs-pgsql15.yml +++ b/.github/workflows/nodejs-pgsql15.yml @@ -49,8 +49,6 @@ jobs: npm run build - name: Test run: npm test - env: - POSTGRES_PORT: 5432 - uses: phoenix-actions/test-reporting@v8 if: success() || failure() id: test-report diff --git a/.github/workflows/nodejs-pgsql16.yml b/.github/workflows/nodejs-pgsql16.yml index 55db347..7f1d052 100644 --- a/.github/workflows/nodejs-pgsql16.yml +++ b/.github/workflows/nodejs-pgsql16.yml @@ -49,8 +49,6 @@ jobs: npm run build - name: Test run: npm test - env: - POSTGRES_PORT: 5432 - uses: phoenix-actions/test-reporting@v8 if: success() || failure() id: test-report diff --git a/.github/workflows/nodejs-pgsql17.yml b/.github/workflows/nodejs-pgsql17.yml index 1e6b841..7f33e57 100644 --- a/.github/workflows/nodejs-pgsql17.yml +++ b/.github/workflows/nodejs-pgsql17.yml @@ -49,8 +49,6 @@ jobs: npm run build - name: Test run: npm test - env: - POSTGRES_PORT: 5432 - uses: phoenix-actions/test-reporting@v8 if: success() || failure() id: test-report diff --git a/.github/workflows/npm-publish.yml b/.github/workflows/npm-publish.yml index 965869e..0e4f6ce 100644 --- a/.github/workflows/npm-publish.yml +++ b/.github/workflows/npm-publish.yml @@ -1,26 +1,15 @@ -name: Manual NPM Release +name: NPM Release on PR Merge on: - workflow_dispatch: - inputs: - version_type: - description: 'Version bump type' - required: true - default: 'patch' - type: choice - options: - - patch - - minor - - major - dry_run: - description: 'Dry run (test without publishing)' - required: false - default: false - type: boolean + pull_request: + types: [closed] + branches: [main] jobs: release: + if: github.event.pull_request.merged == true && contains(github.event.pull_request.labels.*.name, 'release') runs-on: ubuntu-latest + environment: github action services: postgres: @@ -35,8 +24,6 @@ jobs: steps: - name: Checkout code uses: actions/checkout@v4 - with: - token: ${{ secrets.GITHUB_TOKEN }} - name: Setup Node.js uses: actions/setup-node@v4 @@ -47,40 +34,38 @@ jobs: - name: Install dependencies run: npm ci - - name: Configure git + - name: Get package version + id: package_version run: | - git config --local user.email "action@github.com" - git config --local user.name "GitHub Action" - - - name: Bump version and create tag - id: version_bump - run: | - if [ "${{ github.event.inputs.dry_run }}" = "true" ]; then - echo "🧪 DRY RUN MODE" - NEW_VERSION=$(npm version ${{ github.event.inputs.version_type }} --no-git-tag-version) - echo "Would bump to version: $NEW_VERSION" - git checkout -- package.json package-lock.json - else - NEW_VERSION=$(npm version ${{ github.event.inputs.version_type }}) - echo "version=$NEW_VERSION" >> $GITHUB_OUTPUT - git push origin main --follow-tags - fi + VERSION=$(node -p "require('./package.json').version") + echo "version=$VERSION" >> $GITHUB_OUTPUT - name: Run tests - env: - POSTGRES_PORT: 5432 run: npm test - name: Build run: npm run build - name: Publish to NPM + run: npm publish + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + + - name: Create tag run: | - if [ "${{ github.event.inputs.dry_run }}" = "true" ]; then - echo "🧪 DRY RUN: Would publish to NPM" - npm publish --access public --dry-run - else - npm publish --access public - fi + git config --local user.email "action@github.com" + git config --local user.name "GitHub Action" + git tag "v${{ steps.package_version.outputs.version }}" + git push origin "v${{ steps.package_version.outputs.version }}" env: - NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} \ No newline at end of file + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Create GitHub Release + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: "v${{ steps.package_version.outputs.version }}" + release_name: Release "v${{ steps.package_version.outputs.version }}" + draft: false + prerelease: false diff --git a/package.json b/package.json index 5339dc4..a3e63da 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "pg-logical-replication", - "version": "2.1.0", + "version": "2.1.1", "description": "PostgreSQL Location Replication client - logical WAL replication streaming", "main": "dist/index.js", "types": "dist/index.d.ts", diff --git a/src/test/client-config.ts b/src/test/client-config.ts index a73cae1..c65949c 100644 --- a/src/test/client-config.ts +++ b/src/test/client-config.ts @@ -3,7 +3,7 @@ import { ClientConfig } from 'pg'; // infra/docker-pg-logical-replication/docker-compose.yml export const TestClientConfig: ClientConfig = { host: process.env.POSTGRES_HOST || 'localhost', - port: Number(process.env.POSTGRES_PORT || 54320), + port: Number(process.env.POSTGRES_PORT || 5432), user: 'postgres', password: 'postgrespw', database: 'playground',