Last active
March 25, 2022 20:57
-
-
Save cakeinpanic/4bdd788829915e3023204421f6661835 to your computer and use it in GitHub Desktop.
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: 'Add new icon' | |
on: | |
push: | |
branches: | |
- 'master' | |
jobs: | |
attempt-rebuild-library: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions/setup-node@v1 | |
name: setup node | |
with: | |
node-version: '14.x' | |
- name: 'install' | |
# we must have the latest version here not regarding what's on package.json | |
# so installing it directly | |
# other packages would also be installed using this command | |
run: npm i @yotpo/icons@latest | |
- name: 'build' | |
run: npm run build:lib | |
- uses: actions/github-script@v5 | |
name: 'check what version to bump' | |
id: check-bump | |
with: | |
script: | | |
const versionToBump = require('.github/scripts/check-if-lib-changed.js') | |
return versionToBump() | |
result-encoding: string | |
- name: 'bump version' | |
if: steps.check-bump.outputs.result != '' | |
# lib folder contains package.json only | |
# built files are in /dist folder which is gitignored | |
working-directory: ./lib | |
run: | | |
npm version ${{ steps.check-bump.outputs.result }} | |
cp -rf . ../dist | |
- name: 'commit and push' | |
if: steps.check-bump.outputs.result != '' | |
run: | | |
git config user.email "bot@yotpo.com" | |
git config user.name "AutocommitBot" | |
git commit lib -m "bump lib verison to $npm_package_version" | |
npm publish dist | |
git tag "v$(npm -s run env echo '$npm_package_version')" | |
git push https://github.com/${GITHUB_REPOSITORY}.git --follow-tags |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment