Skip to content

Commit

Permalink
feat(ci): 🚀 Migrate CI and Deployment to Github actions
Browse files Browse the repository at this point in the history
  • Loading branch information
RaimondB committed Jun 25, 2023
1 parent 1ca2b6d commit 0ba1813
Show file tree
Hide file tree
Showing 4 changed files with 76 additions and 2 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/automerge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@ on:
check_suite:
types:
- completed
status: {}
status:
jobs:
automerge:
runs-on: ubuntu-latest
steps:
- name: automerge
uses: "pascalgn/automerge-action@f81beb99aef41bb55ad072857d43073fba833a98"
uses: "pascalgn/automerge-action@v0.15.6"
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
MERGE_LABELS: "dependencies,!work in progress"
Expand Down
30 changes: 30 additions & 0 deletions .github/workflows/npm-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# This workflow will run tests using node and then publish a package to GitHub Packages when a release is created
# For more information see: https://docs.github.com/en/actions/publishing-packages/publishing-nodejs-packages

name: NPM-CI

on:
push:
branches-ignore:
- master

jobs:
build:
strategy:
matrix:
node-version: [14.x, 16.x, 18.x, 20.x]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- run: npm ci
- run: npm test -- --reporter json --reporter-option output=test-results.json
- name: Archive test results
uses: actions/upload-artifact@v3
if: success() || failure()
with:
name: test-results-report
path: test-results.json
28 changes: 28 additions & 0 deletions .github/workflows/npm-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: NPM-Publish

on:
workflow_dispatch:
inputs: {}
push:
branches:
- 'master'

jobs:
publish-npm:
# if: ${{github.GITHUB_REF == 'refs/heads/master'}}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
# See below for current versions supported by Node-red
# https://nodered.org/docs/faq/node-versions#installing-nodejs
node-version: 18
registry-url: https://registry.npmjs.org/
- run: npm ci
- run: npm test
- run: npx semantic-release
env:
# NODE_AUTH_TOKEN: ${{secrets.npm_token}}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
16 changes: 16 additions & 0 deletions .github/workflows/test-report.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: 'Test Report'
on:
workflow_run:
workflows: ['NPM-CI'] # runs after CI workflow
types:
- completed
jobs:
report:
runs-on: ubuntu-latest
steps:
- uses: dorny/test-reporter@v1
with:
artifact: test-results-report # artifact name
name: Mocha Tests # Name of the check run which will be created
path: '*.json' # Path to test results (inside artifact .zip)
reporter: mocha-json # Format of test results

0 comments on commit 0ba1813

Please sign in to comment.