Skip to content

Release 2.2.0

Release 2.2.0 #15

Workflow file for this run

name: 'CI'
on:
workflow_dispatch:
push:
paths:
- '**.ts'
- '**.js'
- '**.yml'
- '**.json'
- '**.md'
pull_request:
paths:
- '**.ts'
- '**.js'
- '**.yml'
- '**.json'
- '**.md'
jobs:
tests:
name: Test
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Expose GIT Commit Data
uses: rlespinasse/git-commit-data-action@v1.x
- name: Install the Interpreter
uses: actions/setup-node@v3
with:
node-version: 16.x
cache: yarn
- name: Load the Cached Dependencies
uses: actions/cache@v3
with:
path: '**/node_modules'
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}
- name: Install Dependencies
run: yarn install
- name: Transpile to Javascript
run: yarn build
- name: Test Types
run: yarn test:types
- name: Test
run: yarn test
- name: Collect coverage
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
outputs:
commit_message: ${{ env.GIT_COMMIT_MESSAGE_SUBJECT }}
# Run publish only when the branch is matches, and the commit message could match a release pattern.
publish:
name: Publish Packages
runs-on: ubuntu-latest
needs: tests
if: ${{ startsWith(needs.tests.outputs.commit_message, 'Release') && success() && github.ref == 'refs/heads/main' }}
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install the Interpreter
uses: actions/setup-node@v3
with:
node-version: 16.x
always-auth: true
cache: yarn
- name: Load the Cached Dependencies
uses: actions/cache@v3
with:
path: '**/node_modules'
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}
- name: Install Dependencies
run: yarn install
- name: Build from source
run: yarn build
- name: Publish to NPM
id: npm-publish
uses: pascalgn/npm-publish-action@1.3.9
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
- name: Change the Interpreter for GPR
if: ${{ steps.npm-publish.outputs.changed == 'true' }}
uses: actions/setup-node@v3
with:
node-version: 16.x
registry-url: 'https://npm.pkg.github.com'
scope: '@hisorange'
cache: yarn
- name: Publish to GPR
if: ${{ steps.npm-publish.outputs.changed == 'true' }}
run: yarn publish --non-interactive
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
outputs:
changed: ${{ steps.npm-publish.outputs.changed == 'true' }}
version: ${{ steps.npm-publish.outputs.version }}
release:
name: Release GH
runs-on: ubuntu-latest
needs: [tests, publish]
if: ${{ success() && needs.publish.outputs.changed == 'true' }}
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Create GitHub Release
uses: softprops/action-gh-release@v1
with:
name: ${{ needs.publish.outputs.version }}
tag_name: ${{ needs.publish.outputs.version }}
draft: false
prerelease: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}