Skip to content

Commit

Permalink
ci(github): change to github actions
Browse files Browse the repository at this point in the history
move from travis to github actions
  • Loading branch information
shairez committed Dec 18, 2020
1 parent 9193bd2 commit 79d08cb
Showing 1 changed file with 112 additions and 0 deletions.
112 changes: 112 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
name: Build
on:
push:
branches:
- master
- staging
pull_request:

jobs:
build:
name: Build and test on node ${{ matrix.node }}
runs-on: ubuntu-latest
strategy:
matrix:
node: ['10', '12']
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
steps:
- name: Checkout Repo
uses: actions/checkout@v2
with:
fetch-depth: '0'
- name: Setup Node
uses: actions/setup-node@v2-beta
with:
node-version: ${{ matrix.node }}
registry-url: 'https://registry.npmjs.org'
- name: Get yarn cache dir
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"

- name: Cache Dependencies
uses: actions/cache@v2
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
with:
path: |
${{ steps.yarn-cache-dir-path.outputs.dir }}
node_modules
*/*/node_modules
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Install dependencies
run: yarn install

- name: Build
run: yarn build

- name: Run Lint and Tests
run: yarn test:full

release:
name: Release
needs: build
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
runs-on: ubuntu-latest
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
steps:
- name: Checkout Repo
uses: actions/checkout@v2
with:
fetch-depth: '0'

- name: Setup Node
uses: actions/setup-node@v2-beta
with:
node-version: '12'
registry-url: 'https://registry.npmjs.org'

- name: Get yarn cache dir
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"

- name: Cache Dependencies
uses: actions/cache@v2
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
with:
path: |
${{ steps.yarn-cache-dir-path.outputs.dir }}
node_modules
*/*/node_modules
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Install dependencies
run: yarn install

- name: Build
run: yarn build

- name: Run Lint and Tests
run: yarn test:full

- name: Upload coverage reports
uses: codecov/codecov-action@v1

- name: Configure CI Git User
run: |
git config --global user.name '@hirezio'
git config --global user.email '[email protected]'
- name: Update Version and Publish to NPM
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
run: yarn semantic-release

0 comments on commit 79d08cb

Please sign in to comment.