Skip to content

Merge pull request #201 from somleng/release-please--branches--main--… #534

Merge pull request #201 from somleng/release-please--branches--main--…

Merge pull request #201 from somleng/release-please--branches--main--… #534

Workflow file for this run

name: Build
on: [push]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version-file: ".tool-versions"
cache: 'npm'
- run: npm ci
- run: npm run lint --if-present
- run: npm test
- run: npm run build
release:
runs-on: ubuntu-latest
needs: build
if: github.ref == 'refs/heads/main'
steps:
- name: Get release version
id: get_release_version
run: |
commit_message="${{ github.event.head_commit.message }}"
[[ "${commit_message,,}" =~ release[[:space:]]*version[[:space:]]*([0-9]+\.[0-9]+\.[0-9]+(\.[0-9]+)?) ]] && release_version=${BASH_REMATCH[1]}
twilio_version=$(npm info twilio version | xargs echo)
release_version="${release_version:-${twilio_version}}"
echo "release_version=$release_version" >> $GITHUB_OUTPUT
- uses: google-github-actions/release-please-action@v3
id: release
with:
release-type: node
release-as: ${{ steps.get_release_version.outputs.release_version }}
token: ${{ secrets.SOMLENG_PERSONAL_ACCESS_TOKEN }}
- uses: actions/checkout@v4
if: ${{ steps.release.outputs.release_created }}
- name: Setup Node
uses: actions/setup-node@v4
if: ${{ steps.release.outputs.release_created }}
with:
node-version-file: ".tool-versions"
cache: 'npm'
registry-url: 'https://registry.npmjs.org'
- name: Publish node package
if: ${{ steps.release.outputs.release_created }}
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
run: |
npm ci
npm run build
npm publish