Skip to content

fix build script

fix build script #13

Workflow file for this run

name: "Push Workflow"
on:
push:
branches:
- master
concurrency:
group: ci-push-${{ github.ref }}
cancel-in-progress: true
jobs:
publish-packages:
name: "Publish Package"
runs-on: ubuntu-latest
steps:
- name: "Checkout"
uses: actions/checkout@v3
with:
fetch-depth: "0"
- name: "Read .nvmrc"
run: echo "##[set-output name=NVMRC;]$(cat .nvmrc)"
id: nvm
- name: "Use Node.js (.nvmrc)"
uses: actions/setup-node@v3
with:
node-version: "${{ steps.nvm.outputs.NVMRC }}"
- name: "Install Dependencies"
run: yarn install
- name: "Build Packages"
run: yarn build
- name: "Authenticate with Registry"
run: |
yarn logout
echo "init-author-name=Frontegg LTD" > .npmrc
echo "[email protected]" >> .npmrc
echo "init-author-url=https://frontegg.com" >> .npmrc
echo "init-license=MIT" >> .npmrc
echo "always-auth=true" >> .npmrc
echo "registry=https://registry.npmjs.org" >> .npmrc
echo "_authToken=$NPM_PUBLISH_TOKEN" >> .npmrc
echo "@frontegg:registry=https://registry.npmjs.org" >> .npmrc
echo "//registry.npmjs.org/:_authToken=$NPM_PUBLISH_TOKEN" >> .npmrc
npm whoami
env:
NPM_PUBLISH_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }}
- name: "Copy .npmrc .npmignore to lib folders"
uses: actions/github-script@v6
with:
script: |
const fs = require("fs");
const npmIgnore = fs.readFileSync('./.npmignore', { encoding:"utf-8" })
const npmrc = fs.readFileSync('./.npmrc', { encoding:"utf-8" })
const libs = ['harmor'];
libs.forEach(lib => {
fs.writeFileSync(`./dist/${lib}/.npmignore`, npmIgnore, { encoding:"utf-8" });
fs.writeFileSync(`./dist/${lib}/.npmrc`, npmrc, { encoding:"utf-8" });
});
- name: "Publish harmor to NPM"
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NODE_AUTH_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }}
run: cd ./dist/harmor && chmod +x ./src/index.js && npm publish --tag latest