Skip to content

Commit

Permalink
Merge pull request #5 from sentinel-hub/feature/github-actions
Browse files Browse the repository at this point in the history
Feature/GitHub actions
  • Loading branch information
sinergise-anze authored Jan 28, 2020
2 parents 9f92f9e + 2e9761b commit 15e02d3
Show file tree
Hide file tree
Showing 3 changed files with 63 additions and 35 deletions.
18 changes: 18 additions & 0 deletions .github/workflows/on_push.yaml
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
45 changes: 45 additions & 0 deletions .github/workflows/on_release.yaml
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
35 changes: 0 additions & 35 deletions .gitlab-ci.yml

This file was deleted.

0 comments on commit 15e02d3

Please sign in to comment.