chat-widget-release-manual #68
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: chat-widget-release-manual | |
on: | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: windows-2019 | |
steps: | |
- name: Checking out for ${{ github.ref }} | |
uses: actions/checkout@v3 | |
- name: Use Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 20.X | |
- name: Update package version | |
working-directory: chat-widget | |
run: npx version-from-git --no-git-tag-version | |
if: ${{ startsWith(github.ref, 'refs/heads/') }} | |
- name: Read package.json | |
id: read-package-json | |
working-directory: chat-widget | |
run: | | |
echo "::set-output name=name::$(cat package.json | jq -r '.name')" | |
echo "::set-output name=version::$(cat package.json | jq -r '.version')" | |
- name: Install packages | |
working-directory: chat-widget | |
run: yarn install --network-timeout 100000 | |
- name: Unit Tests | |
working-directory: chat-widget | |
run: yarn test:unit | |
- name: Build Storybook | |
working-directory: chat-widget | |
env : | |
NODE_OPTIONS: --openssl-legacy-provider | |
run: yarn build-storybook | |
- name: VRT Tests | |
working-directory: chat-widget | |
run: yarn test:visual | |
- name: Upload VRT Tests failures screenshots | |
uses: actions/upload-artifact@v3 | |
if: failure() | |
with: | |
name: VRT Failure Screenshots | |
path: 'chat-widget/**/__diff_output__/*.png' | |
- name: Build package | |
working-directory: chat-widget | |
run: yarn build | |
- name: Npm packaging | |
working-directory: chat-widget | |
run: npm pack | |
- name: Move package tarball to root | |
working-directory: chat-widget | |
run: | | |
mv *.tgz ../ | |
- name: Upload a Build Artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: npm-tarball | |
path: '*.tgz' | |
publish: | |
needs: build | |
runs-on: ubuntu-latest | |
if: ${{ startsWith(github.ref, 'refs/heads/') || startsWith(github.ref, 'refs/tags/') }} | |
steps: | |
- uses: actions/download-artifact@v3 | |
with: | |
name: npm-tarball | |
- name: Read package.json | |
id: read-package-json | |
run: | | |
echo "::set-output name=name::$(tar xOf *.tgz package/package.json | jq -r '.name')" | |
echo "::set-output name=version::$(tar xOf *.tgz package/package.json | jq -r '.version')" | |
echo "::set-output name=tarball::$(ls *.tgz)" | |
echo "::set-output name=date::$(date +%Y-%m-%d)" | |
- name: Run npm publish ${{ steps.read-package-json.outputs.name }}@${{ steps.read-package-json.outputs.version }} | |
run: | | |
npm config set //registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }} | |
npm publish *.tgz --tag main --access public | |
npm dist-tag add ${{ steps.read-package-json.outputs.name }}@${{ steps.read-package-json.outputs.version }} latest |