-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5 from sentinel-hub/feature/github-actions
Feature/GitHub actions
- Loading branch information
Showing
3 changed files
with
63 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
name: Lint | ||
on: [push, pull_request] | ||
|
||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v1 | ||
|
||
- name: Use Node.js | ||
uses: actions/setup-node@v1 | ||
with: | ||
node-version: '12' | ||
|
||
- name: Run linter | ||
run: | | ||
npm install | ||
npm run lint |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
name: Deploy to NPM | ||
on: | ||
release: | ||
types: [published] | ||
|
||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v1 | ||
|
||
- name: Use Node.js | ||
uses: actions/setup-node@v1 | ||
with: | ||
node-version: '12' | ||
|
||
- name: Install packages | ||
if: success() && startsWith(github.ref, 'refs/tags/v') | ||
run: | | ||
npm install | ||
- name: Build and deploy | ||
if: success() && startsWith(github.ref, 'refs/tags/v') | ||
env: | ||
GITHUB_REF_TAG: ${{ github.ref }} | ||
NPMJS_REGISTRY: registry.npmjs.org | ||
NPMJS_TOKEN: ${{ secrets.NPM_TOKEN }} | ||
run: | | ||
echo "Extracting version from GITHUB_REF_TAG: $GITHUB_REF_TAG" | ||
export VERSION=$(echo "$GITHUB_REF_TAG" | sed -e "s#^refs/tags/##") | ||
echo "Version is $VERSION" | ||
npm version --no-git-tag-version "${VERSION}" | ||
npm run build | ||
echo "//${NPMJS_REGISTRY}/:_authToken=${NPMJS_TOKEN}" > .npmrc | ||
[ $(echo "${VERSION}" | grep rc) ] && echo "publishing with next tag to npm - ${VERSION}" || echo "publishing with latest tag to npm - ${VERSION}" | ||
[ $(echo "${VERSION}" | grep rc) ] && npm publish --access public --tag next || npm publish --access public | ||
echo "Published to npm registry: ${NPMJS_REGISTRY}" | ||
tar -cvzf /tmp/dist.tar.gz dist/ | ||
- name: Create artifacts | ||
if: success() && startsWith(github.ref, 'refs/tags/v') | ||
uses: actions/upload-artifact@master | ||
with: | ||
name: dist.tar.gz | ||
path: /tmp/dist.tar.gz |
This file was deleted.
Oops, something went wrong.