Skip to content

In the clearDevice function, first determine whether there is a devic… #39

In the clearDevice function, first determine whether there is a devic…

In the clearDevice function, first determine whether there is a devic… #39

name: Publish Npm Package
on:
push:
branches: [ main ]
paths-ignore:
- 'README.md'
- '.github/*'
jobs:
check:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [12.x, 14.x, 16.x]
steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
- name: Cache node modules
uses: actions/cache@v2
env:
cache-name: cache-node-modules
with:
path: ~/.npm
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- run: npm ci
- run: npm test
- run: npm run build
publish:
needs: check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: '14.x'
- name: Cache node modules
uses: actions/cache@v2
env:
cache-name: cache-node-modules
with:
path: ~/.npm
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- run: npm ci
# Don't push translations to TX, the push step will be run by the distro repository.
# - name: Push i18n
# run: |
# export TX_TOKEN=${{ secrets.TX_TOKEN }}
# npm run i18n:src
# npm run i18n:push
- run: npm run build
- name: Get package main version
id: package-version
uses: martinbeentjes/[email protected]
- name: Generate release version
run: |
echo "RELEASE_VERSION=${{ steps.package-version.outputs.current-version }}-prerelease.$(date +'%Y%m%d%H%M%S')" >> $GITHUB_ENV
- name: Set package version
run: npm --no-git-tag-version version $RELEASE_VERSION
- name: Tag release
run: |
git tag $RELEASE_VERSION
git push https://x-access-token:${{ secrets.GH_TOKEN }}@github.com/$GITHUB_REPOSITORY $RELEASE_VERSION
- uses: JS-DevTools/npm-publish@v1
with:
token: ${{ secrets.NPM_TOKEN }}