Update ci.yaml

This commit is contained in:
Garrone Joseph 2020-08-18 16:44:51 +02:00 committed by GitHub
parent 4d9985bc7f
commit 5d75956e0c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -2,10 +2,10 @@ name: ci
on: on:
push: push:
branches: branches:
- master - develop
pull_request: pull_request:
branches: branches:
- master - develop
jobs: jobs:
@ -35,7 +35,8 @@ jobs:
node-version: ${{ matrix.node }} node-version: ${{ matrix.node }}
- run: npm ci - run: npm ci
- run: npm run build - run: npm run build
- run: npm run test - run: npm run test:node
trigger_publish: trigger_publish:
name: Trigger publish.yaml workflow if package.json version updated ( and secrets.PAT is set ). name: Trigger publish.yaml workflow if package.json version updated ( and secrets.PAT is set ).
@ -45,27 +46,30 @@ jobs:
if: github.event_name == 'push' && github.event.head_commit.author.name != 'ts_ci' if: github.event_name == 'push' && github.event.head_commit.author.name != 'ts_ci'
needs: test_node needs: test_node
steps: steps:
- name: Get version on branch 'latest'
- name: Get version on latest
id: v_latest id: v_latest
uses: garronej/github_actions_toolkit@v1.4 uses: garronej/github_actions_toolkit@v1.6
with: with:
action_name: get_package_json_version action_name: get_package_json_version
owner: ${{github.repository_owner}} owner: ${{github.repository_owner}}
repo: ${{github.event.repository.name}} repo: ${{github.event.repository.name}}
branch: latest branch: latest
compare_to_version: '0.0.0' compare_to_version: '0.0.0'
- name: Get version on master
id: v_master - name: Get version on develop
uses: garronej/github_actions_toolkit@v1.4 id: v_develop
uses: garronej/github_actions_toolkit@v1.6
with: with:
action_name: get_package_json_version action_name: get_package_json_version
owner: ${{github.repository_owner}} owner: ${{github.repository_owner}}
repo: ${{github.event.repository.name}} repo: ${{github.event.repository.name}}
branch: ${{ github.sha }} branch: ${{ github.sha }}
compare_to_version: ${{steps.v_latest.outputs.version || '0.0.0'}} compare_to_version: ${{steps.v_latest.outputs.version || '0.0.0'}}
- name: 'Trigger the ''publish'' workflow if newer version'
if: ${{ !!env.PAT && steps.v_master.outputs.compare_result == '1' }} - name: 'Trigger the ''publish'' workflow'
uses: garronej/github_actions_toolkit@v1.4 if: ${{ !!env.PAT && steps.v_develop.outputs.compare_result == '1' }}
uses: garronej/github_actions_toolkit@v1.6
env: env:
GITHUB_TOKEN: ${{ secrets.PAT }} GITHUB_TOKEN: ${{ secrets.PAT }}
with: with:
@ -78,7 +82,7 @@ jobs:
format( format(
'{{"from_version":"{0}","to_version":"{1}","repo":"{2}"}}', '{{"from_version":"{0}","to_version":"{1}","repo":"{2}"}}',
steps.v_latest.outputs.version, steps.v_latest.outputs.version,
steps.v_master.outputs.version, steps.v_develop.outputs.version,
github.event.repository.name github.event.repository.name
) )
}} }}