diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml deleted file mode 100644 index e9e1ffff..00000000 --- a/.github/workflows/publish.yml +++ /dev/null @@ -1,78 +0,0 @@ -name: Publish taskrouter-sdk to npm - -on: - pull_request: - types: [labeled] - branches: - - release/* -env: - NODE_VERSION: 20.20 - DIST_DIR: ./dist - ARTIFACTORY_URL: ${{ vars.ARTIFACTORY_URL }} - -jobs: - deploy: - name: Publish to npm - runs-on: ubuntu-x64 - if: github.event.label.name == 'trigger-release' && github.repository_owner == 'twilio' - environment: production # manual-approval gate + scoped to publish - permissions: - contents: read - id-token: write # required for npm OIDC trusted publishing - steps: - - - name: Extract version from package.json - id: extract-version - run: | - version=$(jq -r '.version' package.json) - echo "version=$version" >> $GITHUB_OUTPUT - echo "Extracted version: $version" - - - name: Checkout code - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4 - - - name: Artifactory OIDC Auth - uses: ./.github/actions/artifactory-oidc - - # Node 24+ required for npm OIDC trusted publisher support (npm >= 11.5.1) - - name: Setup Node 20.20 - uses: actions/setup-node@249970729cb0ef3589644e2896645e5dc5ba9c38 # v6 - with: - node-version: ${{ env.NODE_VERSION }} - - - name: Upgrade npm for trusted publishing (OIDC) - run: npm install -g npm@11.18 # needs >= 11.5.1 for OIDC publish - - - name: Install and Build taskrouter-sdk - run: yarn install && yarn run build - - - name: Validate tag matches package.json version - run: | - TAG="${GITHUB_REF#refs/tags/}" - if [[ ! "$TAG" =~ ^v[0-9]+\.[0-9]+\.[0-9]+ ]]; then - echo "::error::Release tag must be v1.2.3 (got '$TAG')"; exit 1 - fi - [ "${TAG#v}" = "$(node -p "require('./package.json').version")" ] \ - || { echo "::error::tag $TAG != package.json version"; exit 1; } - - name: Publish - env: - RELEASE_VERSION: ${{ steps.extract-version.outputs.version }} - run: | - cd ${{ env.DIST_DIR }}/ - if [[ "$RELEASE_VERSION" == *-rc* ]]; then - npm publish --ignore-scripts --tag=rc --provenance - else - npm publish --ignore-scripts --provenance - fi - - name: Tag version - uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 - env: - RELEASE_VERSION: ${{ steps.extract-version.outputs.version }} - with: - script: | - await github.rest.git.createRef({ - owner: context.repo.owner, - repo: context.repo.repo, - ref: `refs/tags/v${process.env.RELEASE_VERSION}`, - sha: context.payload.pull_request.head.sha - }); \ No newline at end of file diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 00000000..d624e86c --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,143 @@ +name: Publish twilio-taskrouter to npm + +on: + pull_request: + types: [labeled] + branches: + - release/* +env: + NODE_VERSION: "20.20" + ARTIFACTORY_URL: ${{ vars.ARTIFACTORY_URL }} + ARTIFACT_NAME: twilio-taskrouter-dist + DIST_DIR: ./dist + +jobs: + ci: + if: github.event.label.name == 'trigger-release' && github.repository_owner == 'twilio' + runs-on: ubuntu-x64 + permissions: + contents: read + id-token: write + pull-requests: write + + outputs: + version: ${{ steps.extract-version.outputs.version }} + + steps: + - name: Remove trigger-release label + uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 + with: + script: | + await github.rest.issues.removeLabel({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: context.payload.pull_request.number, + name: 'trigger-release' + }) + + - name: Checkout code + uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4 + - name: Artifactory OIDC Auth + uses: ./.github/actions/artifactory-oidc + + - name: Setup Node 20.20 + uses: actions/setup-node@249970729cb0ef3589644e2896645e5dc5ba9c38 # v6 + with: + node-version: ${{ env.NODE_VERSION }} + registry-url: https://registry.npmjs.org + - name: Upgrade npm for trusted publishing (OIDC) + run: npm install --ignore-engines -g npm@11.18 + - name: Extract version from package.json + id: extract-version + run: | + version=$(jq -r '.version' package.json) + echo "version=$version" >> $GITHUB_OUTPUT + echo "Extracted version: $version" + + - name: Validate version + run: | + VERSION=${{ steps.extract-version.outputs.version }} + echo "Releasing version: $VERSION" + # Fail if version already exists in npm registry + npm view twilio-taskrouter@$VERSION version --registry https://registry.npmjs.org && exit 1 || true + - name: Install and Build twilio-taskrouter + run: yarn install --frozen-lockfile --ignore-scripts && yarn run build + - name: Upload Build Artifacts + uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 + + with: + name: ${{ env.ARTIFACT_NAME }} + path: ${{ env.DIST_DIR }} + + deploy: + needs: ci + runs-on: ubuntu-x64 + environment: production + permissions: + contents: write + id-token: write + pull-requests: write + pages: write + + steps: + - name: Checkout code + uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4 + + - name: Download Build Artifacts + uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 + + with: + name: ${{ env.ARTIFACT_NAME }} + path: ${{ env.DIST_DIR }} + + - name: Setup Node 20.20 + uses: actions/setup-node@249970729cb0ef3589644e2896645e5dc5ba9c38 # v6 + with: + node-version: ${{ env.NODE_VERSION }} + registry-url: https://registry.npmjs.org + + - name: Upgrade npm for trusted publishing (OIDC) + run: npm install --ignore-engines -g npm@11.18 + + - name: Publish + env: + RELEASE_VERSION: ${{ needs.ci.outputs.version }} + run: | + if [[ "$RELEASE_VERSION" == *-rc* ]]; then + npm publish --ignore-scripts --tag=rc --provenance + else + npm publish --ignore-scripts --provenance + fi + + - name: Upload docs to GitHub Pages + uses: actions/upload-pages-artifact@7b1f4a764d45c48632c6b24a0339c27f5614fb0b + with: + path: dist/docs + + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@d6db90164ac5ed86f2b6aed7e0febac5b3c0c03e # v4 + + - name: Tag version + uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 + env: + RELEASE_VERSION: ${{ needs.ci.outputs.version }} + with: + script: | + await github.rest.git.createRef({ + owner: context.repo.owner, + repo: context.repo.repo, + ref: `refs/tags/v${process.env.RELEASE_VERSION}`, + sha: context.payload.pull_request.head.sha + }); + + - name: Add RELEASED label + uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 + with: + script: | + await github.rest.issues.addLabels({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: context.payload.pull_request.number, + labels: ['RELEASED'] + }); \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index a0f197b7..e3db8a21 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,11 @@ +3.1.0-rc.1 +========== +Maintenance +---------- +- Enabled regional support +- Bumped `ws` to `^8.20.1` +- Updated dependencies to address reported vulnerabilities. + 3.0.0 ========== Breaking Changes diff --git a/package.json b/package.json index c88e0d0c..faa211a8 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "twilio-taskrouter", "title": "Twilio TaskRouter", - "version": "3.1.0-dev", + "version": "3.1.0-rc.1", "description": "Twilio TaskRouter JavaScript library", "homepage": "https://www.twilio.com", "author": "Wanjun Li ",