Skip to content

Commit 15e02d3

Browse files
Merge pull request #5 from sentinel-hub/feature/github-actions
Feature/GitHub actions
2 parents 9f92f9e + 2e9761b commit 15e02d3

File tree

3 files changed

+63
-35
lines changed

3 files changed

+63
-35
lines changed

.github/workflows/on_push.yaml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
name: Lint
2+
on: [push, pull_request]
3+
4+
jobs:
5+
test:
6+
runs-on: ubuntu-latest
7+
steps:
8+
- uses: actions/checkout@v1
9+
10+
- name: Use Node.js
11+
uses: actions/setup-node@v1
12+
with:
13+
node-version: '12'
14+
15+
- name: Run linter
16+
run: |
17+
npm install
18+
npm run lint

.github/workflows/on_release.yaml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: Deploy to NPM
2+
on:
3+
release:
4+
types: [published]
5+
6+
jobs:
7+
test:
8+
runs-on: ubuntu-latest
9+
steps:
10+
- uses: actions/checkout@v1
11+
12+
- name: Use Node.js
13+
uses: actions/setup-node@v1
14+
with:
15+
node-version: '12'
16+
17+
- name: Install packages
18+
if: success() && startsWith(github.ref, 'refs/tags/v')
19+
run: |
20+
npm install
21+
22+
- name: Build and deploy
23+
if: success() && startsWith(github.ref, 'refs/tags/v')
24+
env:
25+
GITHUB_REF_TAG: ${{ github.ref }}
26+
NPMJS_REGISTRY: registry.npmjs.org
27+
NPMJS_TOKEN: ${{ secrets.NPM_TOKEN }}
28+
run: |
29+
echo "Extracting version from GITHUB_REF_TAG: $GITHUB_REF_TAG"
30+
export VERSION=$(echo "$GITHUB_REF_TAG" | sed -e "s#^refs/tags/##")
31+
echo "Version is $VERSION"
32+
npm version --no-git-tag-version "${VERSION}"
33+
npm run build
34+
echo "//${NPMJS_REGISTRY}/:_authToken=${NPMJS_TOKEN}" > .npmrc
35+
[ $(echo "${VERSION}" | grep rc) ] && echo "publishing with next tag to npm - ${VERSION}" || echo "publishing with latest tag to npm - ${VERSION}"
36+
[ $(echo "${VERSION}" | grep rc) ] && npm publish --access public --tag next || npm publish --access public
37+
echo "Published to npm registry: ${NPMJS_REGISTRY}"
38+
tar -cvzf /tmp/dist.tar.gz dist/
39+
40+
- name: Create artifacts
41+
if: success() && startsWith(github.ref, 'refs/tags/v')
42+
uses: actions/upload-artifact@master
43+
with:
44+
name: dist.tar.gz
45+
path: /tmp/dist.tar.gz

.gitlab-ci.yml

Lines changed: 0 additions & 35 deletions
This file was deleted.

0 commit comments

Comments
 (0)