This commit is contained in:
Joseph Garrone 2020-05-14 00:47:15 +02:00
parent 224dc389eb
commit a55f9e86eb
14 changed files with 449 additions and 2 deletions

75
.github/workflows/ci.yaml vendored Normal file
View file

@ -0,0 +1,75 @@
name: ci
on:
push:
branches:
- dev
pull_request:
branches:
- dev
jobs:
test_node:
runs-on: ubuntu-latest
if: ${{ !github.event.created }}
strategy:
matrix:
node: [ '13', '12', '11', '10', '8' ]
name: Test with Node v${{ matrix.node }}
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node }}
- run: npm install
- run: npm run build
- run: npm run test:node
trigger_publish:
name: Trigger publish.yaml workflow if package.json version updated ( and secrets.PAT is set ).
runs-on: ubuntu-latest
env:
PAT: ${{secrets.PAT}}
if: github.event_name == 'push' && github.event.head_commit.author.name != 'denoify_ci'
needs: test_node
steps:
- name: Get version on branch 'latest'
id: v_latest
uses: garronej/github_actions_toolkit@master
with:
action_name: get_package_json_version
owner: ${{github.repository_owner}}
repo: ${{github.event.repository.name}}
branch: latest
- name: Get version on master
id: v_master
uses: garronej/github_actions_toolkit@master
with:
action_name: get_package_json_version
owner: ${{github.repository_owner}}
repo: ${{github.event.repository.name}}
branch: ${{ github.sha }}
- name: 'Trigger the ''publish'' workflow'
if: ${{ !!env.PAT && steps.v_latest.outputs.version != steps.v_master.outputs.version && steps.v_master.outputs.version != '0.0.0' }}
uses: garronej/github_actions_toolkit@master
env:
GITHUB_TOKEN: ${{ secrets.PAT }}
with:
action_name: dispatch_event
owner: ${{github.repository_owner}}
repo: ${{github.event.repository.name}}
event_type: publish
client_payload_json: |
${{
format(
'{{"from_version":"{0}","to_version":"{1}","repo":"{2}"}}',
steps.v_latest.outputs.version,
steps.v_master.outputs.version,
github.event.repository.name
)
}}