Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhance pipeline 💪🏼 #62

Merged
merged 2 commits into from
Jan 24, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 47 additions & 3 deletions .github/workflows/nodejs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,28 @@ name: Node CI
on: [push]

jobs:
####### Print: Prints some context relating to the job to make future debugging easier
print:
name: Print context
runs-on: ubuntu-latest
timeout-minutes: 10

steps:
- uses: actions/checkout@v1
- uses: actions/setup-node@v1
with:
node-version: 12.x
- name: Print context 🎉
env:
GH_REF: ${{ github.ref }}
run: |
echo "GH_REF: ${GH_REF}"

####### Lint
lint:
name: 'Lint'
runs-on: ubuntu-latest
timeout-minutes: 10

steps:
- uses: actions/checkout@v1
Expand All @@ -20,6 +38,7 @@ jobs:
unit_tests:
name: 'Unit tests'
runs-on: ubuntu-latest
timeout-minutes: 10

strategy:
matrix:
Expand All @@ -34,13 +53,38 @@ jobs:
- run: yarn build
- run: yarn test

####### Deploy website (triggers when committing tags)
website:
name: Deploy website
####### Publish to npm
npm_publish:
name: Publish to npm
runs-on: ubuntu-latest
timeout-minutes: 10
needs: [lint, unit_tests]
if: startsWith(github.ref, 'refs/tags/')

steps:
- uses: actions/checkout@v1
- uses: actions/setup-node@v1
with:
node-version: 12.x
registry-url: https://registry.npmjs.org/
- name: yarn publish
env:
IS_ALPHA: ${{ contains(github.ref, 'alpha')}}
IS_BETA: ${{ contains(github.ref, 'beta')}}
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
run: |
if [ ${IS_ALPHA} = true ]; then export NPM_TAG="--tag alpha"; fi
if [ ${IS_BETA} = true ]; then export NPM_TAG="--tag beta"; fi
yarn
yarn publish ${NPM_TAG}

####### Deploy website
website:
name: Deploy website
runs-on: ubuntu-latest
timeout-minutes: 10
needs: [npm_publish]

steps:
- uses: actions/checkout@v1
- uses: actions/setup-node@v1
Expand Down