Manual Publish to NPM #61
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: Manual Publish to NPM | |
on: | |
workflow_dispatch | |
jobs: | |
build-iac: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: '16.x' | |
registry-url: 'https://registry.npmjs.org' | |
- name: Install Root Dependencies | |
run: npm install | |
- name: Get latest version | |
id: get_npm_version | |
run: echo "version=$(npm view @esri/instant-apps-components version)" >> $GITHUB_OUTPUT | |
- name: Get local version | |
id: get_local_version | |
run: echo "localVersion=$(node -p 'require("./packages/instant-apps-components/package.json").version')" >> $GITHUB_OUTPUT | |
- name: Check if versions are the same | |
run: | | |
if [ "${{ steps.get_npm_version.outputs.version }}" = "${{ steps.get_local_version.outputs.localVersion }}" ]; then | |
echo "Versions are the same. Please update instant-apps-components package.json version, exiting" | |
exit 1 | |
fi | |
- name: iac publish steps | |
run: | | |
cd packages/instant-apps-components | |
git pull origin master | |
npm install | |
npm run build | |
npm publish | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.AUTOMATED_NPM_PUBLISH }} | |
- name: Update @esri/instant-apps-components in instant-apps-components-react package.json | |
run: | | |
cd packages/instant-apps-components-react | |
npm version ${{ steps.get_local_version.outputs.localVersion }} | |
npm update @esri/instant-apps-components | |
cat package.json | |
- name: iac react publish steps | |
run: | | |
cd packages/instant-apps-components-react | |
npm install | |
npm run build | |
npm publish | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.AUTOMATED_NPM_PUBLISH }} |