Skip to content

Commit

Permalink
Merge pull request #279 from ndrsn/ci
Browse files Browse the repository at this point in the history
Add workflows for testing / releasing
  • Loading branch information
TonyGermaneri committed Jul 24, 2020
2 parents 7c6a613 + eb3f2cb commit 496a3c8
Show file tree
Hide file tree
Showing 4 changed files with 6,360 additions and 1 deletion.
111 changes: 111 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
name: Release new tagged version

on:
push:
# Sequence of patterns matched against refs/tags
tags:
- 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10

jobs:
build:
name: Build and test
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [14.x]

steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- name: Install dependencies
run: npm ci
- name: Build
run: npm run build-all --if-present
- name: Test
run: npm test
- name: Upload build artifacts
uses: actions/upload-artifact@v2
with:
name: dist
path: ./dist/*

release:
name: Release
runs-on: ubuntu-latest
needs: build

strategy:
matrix:
node-version: [14.x]

steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Download build
uses: actions/download-artifact@v2
with:
name: dist
path: ./dist
- name: Include dist/ folder (the build) in release
run: |
zip -r ${{ github.event.repository.name }}.zip *
- name: Create release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
draft: false
prerelease: false
- name: Upload Release Asset
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
# This pulls from the CREATE RELEASE step above, referencing its ID
# to get its outputs object, which include a `upload_url`. See this
# blog post for more info:
# https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./${{ github.event.repository.name }}.zip
asset_name: ${{ github.event.repository.name }}.zip
asset_content_type: application/zip
- name: Publish NPM Module
uses: JS-DevTools/npm-publish@v1
with:
token: ${{ secrets.NPM_DEPLOY_KEY }}

publish-documentation:
name: Publish documentation
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [14.x]

steps:
- name: Checkout
uses: actions/checkout@v2
- name: Install Node
uses: actions/setup-node@v1
with:
node-version: '14.x'
- name: Install dependencies
run: npm ci
- name: Build documentation
run: npm run build-docs
# This will make documentation available at
# https://<username>.github.io/canvas-datagrid/docs/
- name: Publish documentation to GitHub pages
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: .
32 changes: 32 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# 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: Test canvas-datagrid

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

jobs:
build:

runs-on: ubuntu-latest

strategy:
matrix:
node-version: [14.x]

steps:
- name: Checkout code from repository
uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- name: Install dependencies
run: npm ci
- name: Test
run: npm test

2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
npm-debug.log
node_modules
build
package-lock.json
dist
Loading

0 comments on commit 496a3c8

Please sign in to comment.