Skip to content

Commit

Permalink
Merge pull request #5 from nextcloud/feat/workflow-auto-update-npm-pu…
Browse files Browse the repository at this point in the history
…blish.yml

Updating npm-publish.yml workflow from template
  • Loading branch information
ChristophWurst authored Sep 28, 2021
2 parents 6d066cd + 44a1e3b commit ca3c863
Showing 1 changed file with 29 additions and 13 deletions.
42 changes: 29 additions & 13 deletions .github/workflows/npm-publish.yml
Original file line number Diff line number Diff line change
@@ -1,35 +1,51 @@

# This workflow is provided via the organization template repository
#
# https:/nextcloud/.github
# https://docs.github.com/en/actions/learn-github-actions/sharing-workflows-with-your-organization

name: Publish

on:
release:
types: [published]

jobs:
build:
publish:
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [12]

name: node${{ matrix.node-version }}
name: Build and publish to npm
steps:
- uses: actions/checkout@v2
- name: Check actor permission level
uses: skjnldsv/check-actor-permission@v2
with:
require: admin

- name: Checkout
uses: actions/checkout@v2

- name: Set up node ${{ matrix.node-version }}
uses: actions/setup-node@v1
- name: Read package.json node and npm engines version
uses: skjnldsv/[email protected]
id: versions
with:
node-version: ${{ matrix.node-version }}
fallbackNode: '^12'
fallbackNpm: '^6'

- name: Set up node ${{ steps.versions.outputs.nodeVersion }}
uses: actions/setup-node@v2
with:
node-version: ${{ steps.versions.outputs.nodeVersion }}

- name: Set up npm ${{ steps.versions.outputs.npmVersion }}
run: npm i -g npm@"${{ steps.versions.outputs.npmVersion }}"

- name: Install dependencies & build
run: |
npm ci
npm run build --if-present
- name: Publish to npm
- name: Publish
run: |
npm config set //registry.npmjs.org/:_authToken=$NODE_AUTH_TOKEN
npm publish
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

0 comments on commit ca3c863

Please sign in to comment.