Publish NPM packages through CI (#3311)

* chore: update CI to publish npm packages during a release

* chore: test on all OSs prior to publishing npm packages and running a release

* auth with npm before publish
This commit is contained in:
Opender Singh 2021-05-15 09:09:11 +12:00 committed by GitHub
parent 5525e6c87f
commit 1271f5a925
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -14,7 +14,45 @@ env:
NPM_CONFIG_RUNTIME: electron
jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: true
matrix:
os: [ macos-latest, windows-latest, ubuntu-latest ]
steps:
- name: Checkout branch
uses: actions/checkout@v1
- name: Read Node version from .nvmrc
run: echo "##[set-output name=NVMRC;]$(cat .nvmrc)"
id: nvm
- uses: actions/setup-node@v1
with:
node-version: ${{ steps.nvm.outputs.NVMRC }}
- name: Bootstrap packages
run: npm run bootstrap
- name: Run tests
run: npm test
npm:
needs: [ test ]
name: npm
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Read Node version from .nvmrc
run: echo "##[set-output name=NVMRC;]$(cat .nvmrc)"
id: nvm
- uses: actions/setup-node@v1
with:
node-version: ${{ steps.nvm.outputs.NVMRC }}
- run: npm run bootstrap
- run: |
npm config set //registry.npmjs.org/:_authToken ${NPM_TOKEN}
npm run publish
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN}}
Windows:
needs: [ npm ]
name: Windows
runs-on: windows-2016
steps:
@ -26,12 +64,12 @@ jobs:
with:
node-version: ${{ steps.nvm.outputs.NVMRC }}
- run: npm run bootstrap
- run: npm run test:pre-release
- run: npm run app-release
env:
CSC_LINK: ${{ secrets.CORE_WINDOWS_CSC_LINK }}
CSC_KEY_PASSWORD: ${{ secrets.CORE_WINDOWS_CSC_KEY_PASSWORD }}
Mac:
needs: [ npm ]
name: Mac
runs-on: macos-latest
steps:
@ -43,7 +81,6 @@ jobs:
with:
node-version: ${{ steps.nvm.outputs.NVMRC }}
- run: npm run bootstrap
- run: npm run test:pre-release
- run: npm run app-release
env:
APPLE_ID: ${{ secrets.DESIGNER_APPLE_ID }}
@ -51,6 +88,7 @@ jobs:
CSC_LINK: ${{ secrets.DESIGNER_MAC_CSC_LINK }}
CSC_KEY_PASSWORD: ${{ secrets.DESIGNER_MAC_CSC_KEY_PASSWORD }}
Linux:
needs: [ npm ]
name: Linux
runs-on: ubuntu-latest
steps:
@ -65,7 +103,6 @@ jobs:
with:
node-version: ${{ steps.nvm.outputs.NVMRC }}
- run: npm run bootstrap
- run: npm run test:pre-release
- run: npm run app-release
env:
BUILD_TARGETS: AppImage,deb,tar.gz,rpm,snap