diff --git a/.github/workflows/node.js.pr.yml b/.github/workflows/node.js.pr.yml deleted file mode 100644 index d5b388e..0000000 --- a/.github/workflows/node.js.pr.yml +++ /dev/null @@ -1,26 +0,0 @@ -# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node -# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions - -name: Angular library - -on: - pull_request: - branches: [ master ] - -jobs: - build: - runs-on: ubuntu-latest - - strategy: - matrix: - node-version: [10.x, 12.x] - - steps: - - uses: actions/checkout@v2 - - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v1 - with: - node-version: ${{ matrix.node-version }} - - run: npm ci - - run: npm run lint - - run: npm run build:prod diff --git a/.github/workflows/node.js.yml b/.github/workflows/node.js.yml index 1861644..a9d5c27 100644 --- a/.github/workflows/node.js.yml +++ b/.github/workflows/node.js.yml @@ -1,14 +1,17 @@ # This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node # For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions -name: Build and publish Angular library +name: Angular library on: push: branches: [ master ] + pull_request: + branches: [ master ] jobs: build: + runs-on: ubuntu-latest strategy: @@ -24,28 +27,3 @@ jobs: - run: npm ci - run: npm run lint - run: npm run build:prod - - npm-publish: - needs: build - name: Publish to NPM - runs-on: ubuntu-latest - steps: - - name: Checkout repository - uses: actions/checkout@v2 - - name: Set up Node.js - uses: actions/setup-node@v1 - with: - node-version: '12' - - run: npm ci - - run: npm run lint - - run: npm run build:prod - - name: Publish if version has been updated - uses: pascalgn/npm-publish-action@1.3.3 - with: - tag_name: "v%s" - tag_message: "v%s" - commit_pattern: "^Release (\\S+)" # Only publish when a commit is created that starts with "Release ..." - workspace: "./dist/muuri-angular" - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - NPM_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }} diff --git a/.github/workflows/npm-publish.yml b/.github/workflows/npm-publish.yml new file mode 100644 index 0000000..fe367fd --- /dev/null +++ b/.github/workflows/npm-publish.yml @@ -0,0 +1,26 @@ +name: npm-publish +on: + push: + tags: + - v*.*.* + +jobs: + npm-publish: + name: npm-publish + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@master + - name: Set up Node.js + uses: actions/setup-node@v1 + with: + node-version: '12' + registry-url: 'https://registry.npmjs.org' + - name: Install dependencies + run: npm ci + - name: Build library + run: npm run build:prod + - name: Publish version + run: cd ./dist/muuri-angular && npm publish + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}