Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
78 changes: 0 additions & 78 deletions .github/workflows/publish.yml

This file was deleted.

143 changes: 143 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -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']
});
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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 <wli@twilio.com>",
Expand Down