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

Fix build #16

Merged
merged 7 commits into from
Oct 24, 2023
Merged
Show file tree
Hide file tree
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
16 changes: 16 additions & 0 deletions .github/workflows/pull_request-workflows.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-nodejs

name: pull_request job

on:
pull_request:
branches: '*'

jobs:
call-resuable-workflows:
uses: ./.github/workflows/resuable-workflows.yml
with:
node-version: '["16.x", "18.x", "20.x"]'
# secrets:
# envPAT: ${{ secrets.envPAT }}
Original file line number Diff line number Diff line change
@@ -1,41 +1,28 @@
# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-nodejs

name: pull_request job
name: push job

on:
pull_request:
branches: '*'
push:
branches: [ "master" ]

jobs:
build:

call-resuable-workflows:
uses: ./.github/workflows/resuable-workflows.yml
with:
node-version: '["20.x"]'

Publish:
needs: call-resuable-workflows
runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
node-version: [16.x, 18.x, 20.x]
node-version: ["20.x"]
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/

steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
registry-url: https://registry.npmjs.org/
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Test
run: npm test
- name: Release
# Check if it's on master branch, then push
if: ${{ github.ref == 'refs/heads/branch' }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPMJS_ACCESS_TOKEN }}
Expand Down
36 changes: 36 additions & 0 deletions .github/workflows/resuable-workflows.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Reusable workflow

on:
workflow_call:
inputs:
node-version:
required: true
type: string
#secrets:
#token:
#required: true

jobs:
build:

runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
node-version: ${{ fromJson(inputs.node-version) }}
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/

steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
registry-url: https://registry.npmjs.org/
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Test
run: npm test