Skip to content

GC-1331 Add user and bell icons (#415) #74

GC-1331 Add user and bell icons (#415)

GC-1331 Add user and bell icons (#415) #74

Workflow file for this run

name: Publish
on:
push:
branches:
- main
jobs:
run-tests:
runs-on: ubuntu-latest
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- name: Checkout repository
uses: actions/checkout@v3
# Setup node and npm with the versions defined in package.json engines.
- name: Install node and npm
uses: './.github/actions/install-node-and-npm'
- name: Install dependencies
run: npm ci --legacy-peer-deps
- name: Run unit tests
run: npm run test:ci
# Publish package to npm
publish:
runs-on: ubuntu-latest
needs: run-tests
env:
# Used to publish the package to the npm registry
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- name: Checkout repository
uses: actions/checkout@v3
# Setup node and npm with the versions defined in package.json engines.
- name: Install node and npm
uses: './.github/actions/install-node-and-npm'
- name: Install dependencies
run: npm ci --legacy-peer-deps
- name: Build the package
run: npm run build
- name: Publish the package to npm
id: publish
uses: JS-DevTools/npm-publish@v1
with:
token: ${{ env.NPM_TOKEN }}
# only publish if the version in package.json has changed
check-version: true
- name: Add git tag ${{ steps.publish.outputs.version }}
if: steps.publish.outputs.type != 'none'
uses: actions/github-script@v5
env:
NEW_VERSION: '${{ steps.publish.outputs.version }}'
OLD_VERSION: '${{ steps.publish.outputs.old-version }}'
with:
script: |
const { OLD_VERSION, NEW_VERSION } = process.env;
console.log(`Version changed: ${OLD_VERSION} => ${NEW_VERSION}`);
// create the tag
const tagRes = await github.rest.git.createRef({
owner: context.repo.owner,
repo: context.repo.repo,
ref: `refs/tags/${NEW_VERSION}`,
sha: context.sha
});
console.log(`Tag creation result: ${tagRes.status}`);
// create the release
console.log(`Creating release ${NEW_VERSION}`);
const relRes = await github.rest.repos.createRelease({
owner: context.repo.owner,
repo: context.repo.repo,
tag_name: NEW_VERSION,
name: NEW_VERSION,
body: `Please refer to [CHANGELOG.md](https://github.com/lob/ui-components/blob/main/CHANGELOG.md) for details.`,
generate_release_notes: true
});
console.log(`Release creation result: ${relRes.status}`);