Skip to content

Commit

Permalink
feat: add github actions workflows (#268)
Browse files Browse the repository at this point in the history
Jira-issue: https://jira.schibsted.io/browse/UUI-766
Type: feat
ref: UUI-766
  • Loading branch information
hunger-programmer authored Jan 19, 2024
1 parent 422d36b commit de6161e
Show file tree
Hide file tree
Showing 13 changed files with 266 additions and 311 deletions.
48 changes: 48 additions & 0 deletions .github/workflows/github-pages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Deploy static content to Pages

on:
push:
branches: [ "master" ]

workflow_dispatch:

permissions:
contents: read
pages: write
id-token: write

concurrency:
group: "pages"
cancel-in-progress: false

jobs:
deploy:
runs-on: ubuntu-latest
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Setup Pages
uses: actions/configure-pages@v4
- name: Setup node
uses: actions/setup-node@v3
with:
node-version-file: ".nvmrc"
cache: "npm"
- name: Install dependencies
run: npm ci
- name: Build docs
run: |
npm run lint
npm run build
npm run test
npm run docs
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: './docs'
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
37 changes: 37 additions & 0 deletions .github/workflows/npm-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Publish Package to npmjs

on:
push:
tags: '*'

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version-file: ".nvmrc"
cache: "npm"
- name: Run tests
run: |
npm run lint
npm run build
npm run test
publish-npm:
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Setup node
uses: actions/setup-node@v3
with:
node-version-file: ".nvmrc"
cache: "npm"
registry-url: https://registry.npmjs.org/
- run: npm ci
- run: npm run build
- run: npm publish --access=public
env:
NODE_AUTH_TOKEN: ${{secrets.NPMJS_AUTHTOKEN}}
34 changes: 34 additions & 0 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Test Pull Request

on:
pull_request:
types:
- opened
- reopened
- synchronize
push:
workflow_dispatch:

jobs:
test:
runs-on: ubuntu-latest
name: Run js tests
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Setup node
uses: actions/setup-node@v3
with:
node-version-file: ".nvmrc"
cache: "npm"
- name: Install dependencies
run: npm ci
- name: Run tests
run: |
npm run lint
npm run build
npm run docs
- name: Run code coverage test
run: npm run cover
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
v18.19.0
26 changes: 0 additions & 26 deletions .travis.yml

This file was deleted.

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ Tags are pushed to NPM via Travis. To release a new version, run in master
$ npm version <major|minor|patch>
```

which will run the test, update version in package.json, commi, tag the commit
which will run the test, update version in package.json, commit, tag the commit
and push.

## LICENSE
Expand Down
Loading

0 comments on commit de6161e

Please sign in to comment.