Skip to content

Change complier

Change complier #56

Workflow file for this run

name: Node.js CI and Publish
on:
pull_request:
branches: [dev, master]
push:
branches: [master]
jobs:
build-and-test:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [16.x]
steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
registry-url: 'https://registry.npmjs.org'
- name: Install dependencies
run: npm ci
- name: Build
run: npm run tsc
- name: Run Mocha tests
run: npm run test
env:
CI: true
publish-pr-version:
needs: build-and-test
if: github.event_name == 'pull_request'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Use Node.js
uses: actions/setup-node@v2
with:
node-version: '16.x'
registry-url: 'https://registry.npmjs.org'
- name: Install dependencies
run: npm ci
- name: Authenticate with npm
run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > ~/.npmrc
- name: Publish PR version to npm
run: |
PR_NUMBER=$(echo $GITHUB_REF | awk 'BEGIN { FS = "/" } ; { print $3 }')
RUN_NUMBER=${GITHUB_RUN_NUMBER}
TAG_VERSION="pr-${PR_NUMBER}.${RUN_NUMBER}"
echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > ~/.npmrc
npm version prerelease --preid=${TAG_VERSION} --no-git-tag-version
npm publish --tag pr --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
publish-release:
needs: build-and-test
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Use Node.js
uses: actions/setup-node@v2
with:
node-version: '16.x'
registry-url: 'https://registry.npmjs.org'
- name: Install dependencies
run: npm run tsc
- name: Authenticate with npm
run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > ~/.npmrc
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: git config
run: |
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
env:
GITHUB_TOKEN: ${{ secrets.SLDEVOPSD_PAT }}
- name: Get Git user
uses: octokit/[email protected]
id: get_user
with:
route: GET /user
env:
GITHUB_TOKEN: ${{ secrets.SLDEVOPSD_PAT }}
- name: Output user info
run: |
echo "Response: ${{ fromJson(steps.get_user.outputs.data) }}"
echo "Git user: ${{ fromJson(steps.get_user.outputs.data).login }}"
echo "Git email: ${{ fromJson(steps.get_user.outputs.data).email }}"
- name: Publish to npm
run: |
npm version patch
npm publish --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Push changes
run: |
git push --follow-tags
env:
GITHUB_TOKEN: ${{ secrets.SLDEVOPSD_PAT }}