Merge pull request #116 from somleng/release-please--branches--main--… #300
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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: | | |
twilio_version=$(npm info twilio version | xargs echo) | |
echo "twilio_version=$twilio_version" >> $GITHUB_OUTPUT | |
- uses: google-github-actions/release-please-action@v4 | |
id: release | |
with: | |
release-type: node | |
release-as: ${{ steps.get_release_version.outputs.twilio_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 |