From 1c2b03ec10b6330948cb01f7facf19f677d69607 Mon Sep 17 00:00:00 2001 From: Erik Engervall Date: Fri, 24 Jan 2020 14:21:37 +0100 Subject: [PATCH] feat: pipeline timeouts feat: pipeline website deployment feat: pipeline npm publish --- .github/workflows/nodejs.yml | 50 +++++++++++++++++++++++++++++++++--- 1 file changed, 47 insertions(+), 3 deletions(-) diff --git a/.github/workflows/nodejs.yml b/.github/workflows/nodejs.yml index 287804c21..9c5daead9 100644 --- a/.github/workflows/nodejs.yml +++ b/.github/workflows/nodejs.yml @@ -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 @@ -20,6 +38,7 @@ jobs: unit_tests: name: 'Unit tests' runs-on: ubuntu-latest + timeout-minutes: 10 strategy: matrix: @@ -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