From e1a49ae0f1d108ed6e2433b63c5d49da4a56a683 Mon Sep 17 00:00:00 2001 From: Antoine SEIN <142824551+asein-sinch@users.noreply.github.com> Date: Thu, 3 Oct 2024 09:55:11 +0200 Subject: [PATCH 1/2] DEVEXP-592: Add workflow for publication --- .github/workflows/publish.yaml | 44 ++++++++++++++++++++++ packages/conversation/package.json | 3 +- packages/elastic-sip-trunking/package.json | 3 +- packages/fax/package.json | 3 +- packages/numbers/package.json | 3 +- packages/sdk-client/package.json | 3 +- packages/sdk-core/package.json | 3 +- packages/sms/package.json | 3 +- packages/verification/package.json | 3 +- packages/voice/package.json | 3 +- 10 files changed, 62 insertions(+), 9 deletions(-) create mode 100644 .github/workflows/publish.yaml diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml new file mode 100644 index 0000000..8cbe353 --- /dev/null +++ b/.github/workflows/publish.yaml @@ -0,0 +1,44 @@ +name: Publish Packages + +on: + workflow_dispatch: + +jobs: + publish: + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v3 + + - name: Set up Node.js + uses: actions/setup-node@v3 + with: + node-version: '18.x' + registry-url: 'https://registry.npmjs.org' + + - name: Authenticate to npm + run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > ~/.npmrc + + - name: Install dependencies + run: yarn install + + - name: Build packages + run: yarn run build + + - name: Run tests + run: yarn run test + + - name: Publish packages + run: | + cd packages/sdk-client && npm publish + cd ../numbers && npm publish + cd ../sms && npm publish + cd ../verification && npm publish + cd ../voice && npm publish + cd ../conversation && npm publish + cd ../fax && npm publish + cd ../elastic-sip-trunking && npm publish + cd ../sdk-core && npm publish + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} diff --git a/packages/conversation/package.json b/packages/conversation/package.json index 29ff5dc..4a71052 100644 --- a/packages/conversation/package.json +++ b/packages/conversation/package.json @@ -33,6 +33,7 @@ }, "devDependencies": {}, "publishConfig": { - "directory": "dist" + "directory": "dist", + "access": "public" } } diff --git a/packages/elastic-sip-trunking/package.json b/packages/elastic-sip-trunking/package.json index 89ea1cd..019438f 100644 --- a/packages/elastic-sip-trunking/package.json +++ b/packages/elastic-sip-trunking/package.json @@ -32,6 +32,7 @@ }, "devDependencies": {}, "publishConfig": { - "directory": "dist" + "directory": "dist", + "access": "public" } } diff --git a/packages/fax/package.json b/packages/fax/package.json index 1024cc2..05b8b21 100644 --- a/packages/fax/package.json +++ b/packages/fax/package.json @@ -33,6 +33,7 @@ }, "devDependencies": {}, "publishConfig": { - "directory": "dist" + "directory": "dist", + "access": "public" } } diff --git a/packages/numbers/package.json b/packages/numbers/package.json index a345935..9ddf77d 100644 --- a/packages/numbers/package.json +++ b/packages/numbers/package.json @@ -33,6 +33,7 @@ }, "devDependencies": {}, "publishConfig": { - "directory": "dist" + "directory": "dist", + "access": "public" } } diff --git a/packages/sdk-client/package.json b/packages/sdk-client/package.json index 53610b5..05fa28f 100644 --- a/packages/sdk-client/package.json +++ b/packages/sdk-client/package.json @@ -38,6 +38,7 @@ "typescript": "^5.2.2" }, "publishConfig": { - "directory": "dist" + "directory": "dist", + "access": "public" } } diff --git a/packages/sdk-core/package.json b/packages/sdk-core/package.json index 9296082..8d9d5c4 100644 --- a/packages/sdk-core/package.json +++ b/packages/sdk-core/package.json @@ -39,6 +39,7 @@ }, "devDependencies": {}, "publishConfig": { - "directory": "dist" + "directory": "dist", + "access": "public" } } diff --git a/packages/sms/package.json b/packages/sms/package.json index 5ca2964..4c5552f 100644 --- a/packages/sms/package.json +++ b/packages/sms/package.json @@ -33,6 +33,7 @@ }, "devDependencies": {}, "publishConfig": { - "directory": "dist" + "directory": "dist", + "access": "public" } } diff --git a/packages/verification/package.json b/packages/verification/package.json index 2dbfc3e..63213a3 100644 --- a/packages/verification/package.json +++ b/packages/verification/package.json @@ -33,6 +33,7 @@ }, "devDependencies": {}, "publishConfig": { - "directory": "dist" + "directory": "dist", + "access": "public" } } diff --git a/packages/voice/package.json b/packages/voice/package.json index 4ad1b2b..a27aff2 100644 --- a/packages/voice/package.json +++ b/packages/voice/package.json @@ -33,6 +33,7 @@ }, "devDependencies": {}, "publishConfig": { - "directory": "dist" + "directory": "dist", + "access": "public" } } From bb653ba72a5faf311297502f15d39a0e7c6c9064 Mon Sep 17 00:00:00 2001 From: Antoine SEIN <142824551+asein-sinch@users.noreply.github.com> Date: Thu, 3 Oct 2024 11:34:34 +0200 Subject: [PATCH 2/2] Add e2e tests before publishing --- .github/workflows/publish.yaml | 41 ++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml index 8cbe353..a2c43d5 100644 --- a/.github/workflows/publish.yaml +++ b/.github/workflows/publish.yaml @@ -29,6 +29,47 @@ jobs: - name: Run tests run: yarn run test + - name: Checkout sinch-sdk-mockserver repository + uses: actions/checkout@v3 + with: + repository: sinch/sinch-sdk-mockserver + token: ${{ secrets.PAT_CI }} + fetch-depth: 0 + path: sinch-sdk-mockserver + + - name: Install Docker Compose + run: | + sudo apt-get update + sudo apt-get install -y docker-compose + + - name: Start mock servers with Docker Compose + run: | + cd sinch-sdk-mockserver + docker-compose up -d + + - name: Create target directories for feature files + run: | + mkdir -p ./packages/fax/tests/e2e/features + mkdir -p ./packages/numbers/tests/e2e/features + mkdir -p ./packages/conversation/tests/e2e/features + mkdir -p ./packages/elastic-sip-trunking/tests/e2e/features + mkdir -p ./packages/sms/tests/e2e/features + mkdir -p ./packages/verification/tests/e2e/features + mkdir -p ./packages/voice/tests/e2e/features + + - name: Copy feature files + run: | + cp sinch-sdk-mockserver/features/fax/*.feature ./packages/fax/tests/e2e/features/ + cp sinch-sdk-mockserver/features/numbers/*.feature ./packages/numbers/tests/e2e/features/ + cp sinch-sdk-mockserver/features/conversation/*.feature ./packages/conversation/tests/e2e/features/ + cp sinch-sdk-mockserver/features/elastic-sip-trunking/*.feature ./packages/elastic-sip-trunking/tests/e2e/features/ + cp sinch-sdk-mockserver/features/sms/*.feature ./packages/sms/tests/e2e/features/ + cp sinch-sdk-mockserver/features/verification/*.feature ./packages/verification/tests/e2e/features/ + cp sinch-sdk-mockserver/features/voice/*.feature ./packages/voice/tests/e2e/features/ + + - name: Run e2e tests + run: yarn run e2e + - name: Publish packages run: | cd packages/sdk-client && npm publish