Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added release action #84

Merged
merged 5 commits into from Sep 21, 2020
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
81 changes: 81 additions & 0 deletions .github/workflows/npm-publish.yml
@@ -0,0 +1,81 @@
name: Manual NPM Publish

on:
workflow_dispatch:
inputs:
releaseType:
description: 'Release type - major, minor or patch'
required: true
default: 'patch'

jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Clone Repository
uses: actions/checkout@v2
- name: Setup Node version
uses: actions/setup-node@v1
with:
node-version: 10.15.1
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should update the node version to latest LTS (including in .nvmrc)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately, this action (setup-node) doesn't support keywords like lts, see actions/setup-node#58. I can bump Node version to match current LTS, but until the PR is merged we will need to do it manually.

- name: Cache dependencies
uses: actions/cache@v2
with:
path: '**/node_modules'
key: ${{ runner.os }}-modules-${{ hashFiles('**/package-lock.json') }}
- name: Install dependencies
run: npm install
christian-bromann marked this conversation as resolved.
Show resolved Hide resolved
- name: Run tests
run: npm test

build:
needs: test
runs-on: ubuntu-latest
steps:
- name: Clone Repository
uses: actions/checkout@v2
- name: Setup Node version
uses: actions/setup-node@v1
with:
node-version: 10.15.1
- name: Cache dependencies
uses: actions/cache@v2
with:
path: '**/node_modules'
key: ${{ runner.os }}-modules-${{ hashFiles('**/package-lock.json') }}
- name: Install dependencies
run: npm install
- name: Build package
run: npm run build
- name: Upload built package
uses: actions/upload-artifact@v2
with:
name: compiled-package
path: build/

release:
needs: build
runs-on: ubuntu-latest
steps:
- name: Clone Repository
uses: actions/checkout@v2
- name: Setup Node version
uses: actions/setup-node@v1
with:
node-version: 10.15.1
registry-url: https://registry.npmjs.org/
- name: Cache dependencies
uses: actions/cache@v2
with:
path: '**/node_modules'
key: ${{ runner.os }}-modules-${{ hashFiles('**/package-lock.json') }}
- name: Install dependencies
run: npm install
farhan-sauce marked this conversation as resolved.
Show resolved Hide resolved
- name: Download built package
uses: actions/download-artifact@v2
with:
name: compiled-package
- name: Release
run: npm run release:${{github.event.inputs.releaseType}}
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
4 changes: 4 additions & 0 deletions package.json
Expand Up @@ -66,6 +66,7 @@
"eslint": "^4.7.2",
"eslint-plugin-import": "^2.8.0",
"jest": "^24.1.0",
"jest-snapshot-serializer-ansi": "^1.0.0",
"np": "^2.18.2",
"npm-run-all": "^4.1.5",
"rimraf": "^2.6.2",
Expand Down Expand Up @@ -93,6 +94,9 @@
],
"coveragePathIgnorePatterns": [
"src/scripts"
],
"snapshotSerializers": [
"jest-snapshot-serializer-ansi"
]
},
"dependencies": {
Expand Down