refactor: Tweaking style #77
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: [ main ] | |
release: | |
types: [ published ] | |
jobs: | |
testandbuild: | |
name: Test and Build | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Use Node 18.x | |
uses: actions/setup-node@v1 | |
with: | |
node-version: '18.x' | |
- name: Get yarn cache directory path | |
id: yarn-cache-dir-path | |
run: echo "::set-output name=dir::$(yarn cache dir)" | |
- name: Cache Yarn | |
uses: actions/cache@v2 | |
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`) | |
with: | |
path: ${{ steps.yarn-cache-dir-path.outputs.dir }} | |
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} | |
restore-keys: | | |
${{ runner.os }}-yarn- | |
- name: Install dependencies | |
run: yarn install | |
- name: Run Tests | |
run: yarn run ng test --watch=false --browsers=ChromeHeadlessCustom | |
- name: Build | |
if: github.event_name == 'release' && github.event.action == 'published' | |
run: yarn run ng build --configuration production | |
- name: Archive build | |
if: github.event_name == 'release' && github.event.action == 'published' | |
uses: actions/upload-artifact@v1 | |
with: | |
name: deploy_dist | |
path: dist | |
deploy: | |
needs: testandbuild | |
runs-on: ubuntu-latest | |
if: github.event_name == 'release' && github.event.action == 'published' | |
steps: | |
- name: Use Node 18.x | |
uses: actions/setup-node@v1 | |
with: | |
node-version: '18.x' | |
registry-url: 'https://registry.npmjs.org' | |
- name: Download build | |
uses: actions/download-artifact@v2 | |
with: | |
name: deploy_dist | |
path: . | |
- name: Set version | |
env: | |
RELEASE_VERSION: ${{ github.event.release.tag_name }} | |
run: npm version --git-tag-version=false $RELEASE_VERSION | |
- name: Publish | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
run: npm publish --access public |