From c505513bede0cf57d3514f74ac5226bfc436a4fa Mon Sep 17 00:00:00 2001 From: Shadi Abu Hilal Date: Mon, 23 Oct 2023 18:51:49 -0700 Subject: [PATCH 1/7] Fix build --- .github/workflows/master-workflows.yml | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/.github/workflows/master-workflows.yml b/.github/workflows/master-workflows.yml index bb8700c..669f3e9 100644 --- a/.github/workflows/master-workflows.yml +++ b/.github/workflows/master-workflows.yml @@ -17,7 +17,12 @@ jobs: strategy: fail-fast: false matrix: + # pull_request + if: ${{ github.event_name == 'pull_request' && github.ref != 'refs/heads/master' }} node-version: [16.x, 18.x, 20.x] + # push + if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }} + node-version: [20.x] # See supported Node.js release schedule at https://nodejs.org/en/about/releases/ steps: @@ -34,8 +39,8 @@ jobs: - name: Test run: npm test - name: Release - # Check if it's on master branch, then push - if: ${{ github.ref == 'refs/heads/branch' }} + # push + if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }} env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} NPM_TOKEN: ${{ secrets.NPMJS_ACCESS_TOKEN }} From 3e665909d3b314877a7043605083cbab7cb4b4c1 Mon Sep 17 00:00:00 2001 From: Shadi Abu Hilal Date: Mon, 23 Oct 2023 18:52:52 -0700 Subject: [PATCH 2/7] Fix build --- .github/workflows/master-workflows.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/master-workflows.yml b/.github/workflows/master-workflows.yml index 669f3e9..003d45b 100644 --- a/.github/workflows/master-workflows.yml +++ b/.github/workflows/master-workflows.yml @@ -18,7 +18,7 @@ jobs: fail-fast: false matrix: # pull_request - if: ${{ github.event_name == 'pull_request' && github.ref != 'refs/heads/master' }} + if: ${{ github.event_name == 'pull_request' }} node-version: [16.x, 18.x, 20.x] # push if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }} From 2f0e582ee04a84277a8a724d487b857af4f36f12 Mon Sep 17 00:00:00 2001 From: Shadi Abu Hilal Date: Mon, 23 Oct 2023 19:19:58 -0700 Subject: [PATCH 3/7] update git actions --- .github/workflows/master-workflows.yml | 47 -------------------- .github/workflows/pull_request-workflows.yml | 17 +++++++ .github/workflows/push-workflows.yml | 23 ++++++++++ .github/workflows/resuable-workflows.yml | 36 +++++++++++++++ 4 files changed, 76 insertions(+), 47 deletions(-) delete mode 100644 .github/workflows/master-workflows.yml create mode 100644 .github/workflows/pull_request-workflows.yml create mode 100644 .github/workflows/push-workflows.yml create mode 100644 .github/workflows/resuable-workflows.yml diff --git a/.github/workflows/master-workflows.yml b/.github/workflows/master-workflows.yml deleted file mode 100644 index 003d45b..0000000 --- a/.github/workflows/master-workflows.yml +++ /dev/null @@ -1,47 +0,0 @@ -# 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: '*' - push: - branches: [ "master" ] - -jobs: - build: - - runs-on: ubuntu-latest - - strategy: - fail-fast: false - matrix: - # pull_request - if: ${{ github.event_name == 'pull_request' }} - node-version: [16.x, 18.x, 20.x] - # push - if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }} - 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 - # push - if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }} - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - NPM_TOKEN: ${{ secrets.NPMJS_ACCESS_TOKEN }} - run: npx semantic-release diff --git a/.github/workflows/pull_request-workflows.yml b/.github/workflows/pull_request-workflows.yml new file mode 100644 index 0000000..bffde19 --- /dev/null +++ b/.github/workflows/pull_request-workflows.yml @@ -0,0 +1,17 @@ +# 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: + environment: development + uses: ./.github/workflows/resuable-workflows.yml + with: + node-version: [16.x, 18.x, 20.x] + # secrets: + # envPAT: ${{ secrets.envPAT }} diff --git a/.github/workflows/push-workflows.yml b/.github/workflows/push-workflows.yml new file mode 100644 index 0000000..5638e1a --- /dev/null +++ b/.github/workflows/push-workflows.yml @@ -0,0 +1,23 @@ +# 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: + push: + branches: [ "master" ] + +jobs: + call-resuable-workflows: + environment: production + uses: ./.github/workflows/resuable-workflows.yml + with: + node-version: [20.x] + steps: + - name: Release + # push + if: ${{ inputs.push }} + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + NPM_TOKEN: ${{ secrets.NPMJS_ACCESS_TOKEN }} + run: npx semantic-release diff --git a/.github/workflows/resuable-workflows.yml b/.github/workflows/resuable-workflows.yml new file mode 100644 index 0000000..1ec3c16 --- /dev/null +++ b/.github/workflows/resuable-workflows.yml @@ -0,0 +1,36 @@ +name: Reusable workflow + +on: + workflow_call: + inputs: + node-version: + required: true + type: array + secrets: + token: + required: true + +jobs: + build: + + runs-on: ubuntu-latest + + strategy: + fail-fast: false + matrix: + node-version: ${{ 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 From ee604b50670aa5caf005845db694cdef2e417d48 Mon Sep 17 00:00:00 2001 From: Shadi Abu Hilal Date: Mon, 23 Oct 2023 20:00:14 -0700 Subject: [PATCH 4/7] Fix build --- .github/workflows/pull_request-workflows.yml | 4 ++-- .github/workflows/push-workflows.yml | 25 +++++++++++++------- .github/workflows/resuable-workflows.yml | 10 +++++--- 3 files changed, 25 insertions(+), 14 deletions(-) diff --git a/.github/workflows/pull_request-workflows.yml b/.github/workflows/pull_request-workflows.yml index bffde19..d22b311 100644 --- a/.github/workflows/pull_request-workflows.yml +++ b/.github/workflows/pull_request-workflows.yml @@ -9,9 +9,9 @@ on: jobs: call-resuable-workflows: - environment: development uses: ./.github/workflows/resuable-workflows.yml with: - node-version: [16.x, 18.x, 20.x] + environment: development + node-version: '["16.x", "18.x", "20.x"]' # secrets: # envPAT: ${{ secrets.envPAT }} diff --git a/.github/workflows/push-workflows.yml b/.github/workflows/push-workflows.yml index 5638e1a..76acdb8 100644 --- a/.github/workflows/push-workflows.yml +++ b/.github/workflows/push-workflows.yml @@ -1,7 +1,7 @@ # 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: push: @@ -9,15 +9,22 @@ on: jobs: call-resuable-workflows: - environment: production uses: ./.github/workflows/resuable-workflows.yml with: - node-version: [20.x] + environment: production + node-version: '["20.x"]' + + Publish: + needs: call-resuable-workflows + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + node-version: ["20.x"] + # See supported Node.js release schedule at https://nodejs.org/en/about/releases/ steps: - name: Release - # push - if: ${{ inputs.push }} - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - NPM_TOKEN: ${{ secrets.NPMJS_ACCESS_TOKEN }} - run: npx semantic-release + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + NPM_TOKEN: ${{ secrets.NPMJS_ACCESS_TOKEN }} + run: npx semantic-release diff --git a/.github/workflows/resuable-workflows.yml b/.github/workflows/resuable-workflows.yml index 1ec3c16..e4206f9 100644 --- a/.github/workflows/resuable-workflows.yml +++ b/.github/workflows/resuable-workflows.yml @@ -3,9 +3,12 @@ name: Reusable workflow on: workflow_call: inputs: + environment: + required: true + type: string node-version: required: true - type: array + type: string secrets: token: required: true @@ -14,11 +17,12 @@ jobs: build: runs-on: ubuntu-latest - + environment: ${{ inputs.environment }} + strategy: fail-fast: false matrix: - node-version: ${{ inputs.node-version }} + node-version: ${{ fromJson(inputs.node-version) }} # See supported Node.js release schedule at https://nodejs.org/en/about/releases/ steps: From 09d73ec8663de27b6ef8f0a8937521fdf57ca11f Mon Sep 17 00:00:00 2001 From: Shadi Abu Hilal Date: Mon, 23 Oct 2023 20:01:32 -0700 Subject: [PATCH 5/7] Fix build --- .github/workflows/pull_request-workflows.yml | 1 - .github/workflows/push-workflows.yml | 1 - 2 files changed, 2 deletions(-) diff --git a/.github/workflows/pull_request-workflows.yml b/.github/workflows/pull_request-workflows.yml index d22b311..01ca254 100644 --- a/.github/workflows/pull_request-workflows.yml +++ b/.github/workflows/pull_request-workflows.yml @@ -11,7 +11,6 @@ jobs: call-resuable-workflows: uses: ./.github/workflows/resuable-workflows.yml with: - environment: development node-version: '["16.x", "18.x", "20.x"]' # secrets: # envPAT: ${{ secrets.envPAT }} diff --git a/.github/workflows/push-workflows.yml b/.github/workflows/push-workflows.yml index 76acdb8..add30d2 100644 --- a/.github/workflows/push-workflows.yml +++ b/.github/workflows/push-workflows.yml @@ -11,7 +11,6 @@ jobs: call-resuable-workflows: uses: ./.github/workflows/resuable-workflows.yml with: - environment: production node-version: '["20.x"]' Publish: From 50d8ef4d499faf7022155be7f1c2ce55f2aa7e60 Mon Sep 17 00:00:00 2001 From: Shadi Abu Hilal Date: Mon, 23 Oct 2023 20:02:26 -0700 Subject: [PATCH 6/7] Fix build --- .github/workflows/resuable-workflows.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.github/workflows/resuable-workflows.yml b/.github/workflows/resuable-workflows.yml index e4206f9..c84c353 100644 --- a/.github/workflows/resuable-workflows.yml +++ b/.github/workflows/resuable-workflows.yml @@ -3,9 +3,6 @@ name: Reusable workflow on: workflow_call: inputs: - environment: - required: true - type: string node-version: required: true type: string @@ -17,7 +14,6 @@ jobs: build: runs-on: ubuntu-latest - environment: ${{ inputs.environment }} strategy: fail-fast: false From d309efe2dfaa9e969cdda7cde0a8b865515322c1 Mon Sep 17 00:00:00 2001 From: Shadi Abu Hilal Date: Mon, 23 Oct 2023 20:03:33 -0700 Subject: [PATCH 7/7] Fix build --- .github/workflows/resuable-workflows.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/resuable-workflows.yml b/.github/workflows/resuable-workflows.yml index c84c353..072a24d 100644 --- a/.github/workflows/resuable-workflows.yml +++ b/.github/workflows/resuable-workflows.yml @@ -6,9 +6,9 @@ on: node-version: required: true type: string - secrets: - token: - required: true + #secrets: + #token: + #required: true jobs: build: