Fix malformed node args when enabling esm in swtc config #35
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: CI | |
on: | |
push: | |
branches: [master] | |
pull_request: | |
jobs: | |
CI: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
node-version: [18.x, 20.x] | |
steps: | |
- name: Check out repository code | |
uses: actions/checkout@v3 | |
- name: Use Node.js ${{ matrix.node-version }} | |
uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ matrix.node-version }} | |
- name: Install dependencies | |
run: npm ci | |
- name: Lint | |
run: npm run lint --if-present | |
- name: Build project | |
run: npm run build --if-present | |
- name: Test | |
run: npm run test --if-present | |
- name: Upload distributable | |
uses: actions/upload-artifact@v3 | |
with: | |
name: node-${{ matrix.node-version }}-dist | |
path: dist/ | |
Publish: | |
needs: CI | |
runs-on: ubuntu-latest | |
if: success() && github.ref == 'refs/heads/master' | |
steps: | |
- name: Check out repository code | |
uses: actions/checkout@v3 | |
- name: Download distributable | |
uses: actions/download-artifact@v3 | |
with: | |
name: node-18.x-dist | |
path: dist/ | |
- name: Use Node.js 18.x | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 18.x | |
registry-url: 'https://registry.npmjs.org' | |
- name: Set latest published version | |
run: echo "LATEST_PUBLISHED_VERSION=$(npm dist-tag ls swtc | sed -n -e 's/^.*latest:\s//p')" >> $GITHUB_ENV | |
- name: Set current version | |
run: echo "PACKAGE_VERSION=$(node -p "require('./package.json').version")" >> $GITHUB_ENV | |
- name: Echo versions | |
run: echo "Latest:${{ env.LATEST_PUBLISHED_VERSION }}, package.json version:${{ env.PACKAGE_VERSION }}" | |
- name: 🚀 Publish | |
if: env.LATEST_PUBLISHED_VERSION != env.PACKAGE_VERSION | |
run: npm publish | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |