Merge pull request #91 from jcardus/patch-1 #40
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: Prod deploy | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
deploy: | |
if: github.repository == 'LuisEnMarroquin/json-as-xlsx' | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- run: yarn | |
- run: yarn test | |
- run: yarn build | |
- name: Copy files to library output folder | |
run: | | |
cp README.md packages/main-library/README.md | |
cp LICENSE packages/main-library/LICENSE | |
- name: Set environment variable for GitHub | |
run: | | |
echo "CURRENT_VERSION=$(node -e "console.log('v' + require('./package.json').version)")" >> $GITHUB_ENV | |
echo CURRENT_VERSION ${{ env.CURRENT_VERSION }} | |
working-directory: packages/main-library/ | |
- name: Publish package to NPM registry | |
run: | | |
echo "//registry.npmjs.org/:_authToken=$NPM_AUTH_TOKEN" > ~/.npmrc | |
npm publish --access public | |
env: | |
NPM_AUTH_TOKEN: ${{ secrets.TOKEN_NPM }} | |
working-directory: packages/main-library/ | |
- name: Create a new GitHub release | |
run: | | |
echo ${{ secrets.TOKEN_GITHUB }} > nothing.md | |
gh auth login --with-token < nothing.md | |
gh release create ${{ env.CURRENT_VERSION }} -F README.md -t "Released ${{ env.CURRENT_VERSION }}" | |
- name: Prepare static files for deployment | |
run: yarn run static | |
- uses: JamesIves/github-pages-deploy-action@v4 | |
with: | |
folder: build | |
branch: gh-pages | |
git-config-name: LuisEnMarroquin | |
git-config-email: [email protected] |