Functionly build and publish #4
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: Functionly build and publish | |
on: | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Docker | |
uses: docker/setup-buildx-action@v1 | |
- name: Build and Test with Coverage | |
run: | | |
docker run --rm \ | |
-e PROPERTIES="BUILD_ID:${{ github.run_number }}" \ | |
-w "/app" \ | |
-v $PWD:/app \ | |
node:8 bash -c "npm i --no-save -q; npm run build; npm run coverage -- --reporter mocha-junit-reporter; chown -R $(id -u):$(id -g) ." | |
- name: Setup .npmrc | |
run: echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > .npmrc | |
env: | |
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | |
- name: Build and Publish to npmjs | |
env: | |
NPM_VERSION: '1.0.0' | |
run: | | |
docker run --rm \ | |
-w "/app" \ | |
-v "$PWD:/app" \ | |
-v "${{ github.workspace }}/.npmrc:/root/.npmrc" \ | |
node:8 bash -c "npm i --no-save -q; npm run build; npm version ${NPM_VERSION} > version.txt; npm publish --tag dev; chown -R $(id -u):$(id -g) ." |