Skip to content

Commit

Permalink
[ci] publish releases on npm using github action
Browse files Browse the repository at this point in the history
  • Loading branch information
mrhyde committed Jan 4, 2020
1 parent 876a901 commit a10d75e
Show file tree
Hide file tree
Showing 2 changed files with 119 additions and 40 deletions.
80 changes: 40 additions & 40 deletions .github/workflows/integration.yml
Original file line number Diff line number Diff line change
@@ -1,41 +1,41 @@
name: Integration testing

on:
push:
paths-ignore:
- 'docs/**'
schedule:
- cron: '0 20 * * *'

jobs:
test:
name: test integration with bitrix portal
runs-on: ubuntu-latest
env:
CI: true
WEBHOOK_URL: ${{ secrets.WEBHOOK_URL }}

steps:
- name: Get node version
id: node
run: echo "::set-output name=version::$(cat .github/.node-version)"
- uses: actions/checkout@v1
with:
fetch-depth: 1
- name: Use node ${{ steps.node.version }}
uses: actions/setup-node@v1
with:
node-version: ${{ steps.node.version }}
- name: Cache node modules
uses: actions/cache@v1
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('package-lock.json') }}
restore-keys: |
${{ runner.os }}
- name: Install dependencies
run: npm ci
- name: Build
run: npm run build
- name: Run integration tests
name: Integration testing

on:
push:
paths-ignore:
- 'docs/**'
schedule:
- cron: '0 20 * * *'

jobs:
test:
name: test integration with bitrix portal
runs-on: ubuntu-latest
env:
CI: true
WEBHOOK_URL: ${{ secrets.WEBHOOK_URL }}

steps:
- name: Get node version
id: node
run: echo "::set-output name=version::$(cat .github/.node-version)"
- uses: actions/checkout@v1
with:
fetch-depth: 1
- name: Use node ${{ steps.node.version }}
uses: actions/setup-node@v1
with:
node-version: ${{ steps.node.version }}
- name: Cache node modules
uses: actions/cache@v1
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('package-lock.json') }}
restore-keys: |
${{ runner.os }}
- name: Install dependencies
run: npm ci
- name: Build
run: npm run build
- name: Run integration tests
run: npm run test:integration
79 changes: 79 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
name: Publishing on NPM

on:
release:
types: [created]

jobs:
test:
name: ensure that build is stable
runs-on: ubuntu-latest
env:
CI: true

steps:
- name: Get node version
id: node
run: echo "::set-output name=version::$(cat .github/.node-version)"
- uses: actions/checkout@v1
with:
fetch-depth: 1
- name: Use node ${{ steps.node.version }}
uses: actions/setup-node@v1
with:
node-version: ${{ steps.node.version }}
- name: Cache node modules
uses: actions/cache@v1
with:
path: "~/.npm"
key: "${{ runner.os }}-node-${{ hashFiles('package-lock.json') }}"
restore-keys: "${{ runner.os }}"
- name: Install dependencies
run: npm ci
- name: Build
run: npm run build
- name: Run unit tests
run: npm run test:unit

publish-npm:
name: publish on npm
needs: test
runs-on: ubuntu-latest

steps:
- name: Get node version
id: node
run: echo "::set-output name=version::$(cat .github/.node-version)"
- uses: actions/checkout@v1
with:
fetch-depth: 1
- uses: actions/setup-node@v1
with:
node-version: ${{ steps.node.version }}
registry-url: https://registry.npmjs.org/
- name: Install dependencies
run: npm ci
- name: Publish release on NPM
run: npm publish
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}

# publish-gpr:
# name: publish on github
# needs: test
# runs-on: ubuntu-latest

# steps:
# - uses: actions/checkout@v1
# with:
# fetch-depth: 1
# - uses: actions/setup-node@v1
# with:
# node-version: 12
# registry-url: https://npm.pkg.github.com/
# scope: '@your-github-username'
# - name: Install dependencies
# run: npm ci
# - run: npm publish
# env:
# NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}}

0 comments on commit a10d75e

Please sign in to comment.