Update Release Notes on supported Node versions (#169) #2
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Connector - Build & Test | |
on: | |
push: | |
# Pattern matched against v<MAJOR>.<MINOR>.<PATCH> | |
tags: | |
- 'v[0-9]+.[0-9]+.[0-9]+' | |
branches: | |
- 'master' | |
- 'release/connector/*' | |
- 'support/connector/*' | |
workflow_run: | |
workflows: ["PR handler"] | |
types: | |
- completed | |
permissions: | |
checks: write | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
name: Build & Test Connector JS | |
outputs: | |
pr_number: ${{ steps.pr_number.outputs.PR_NUMBER }} | |
strategy: | |
matrix: | |
version: [17, 18, 20, lts, latest] | |
steps: | |
# Download the artifacts generated by "PR Handler" if this workflow was | |
# triggered by a workflow_run event. | |
- name: Download artifact | |
if: ${{ github.event_name == 'workflow_run' }} | |
uses: actions/github-script@v3.1.0 | |
with: | |
script: | | |
var fs = require('fs'); | |
var artifacts = await github.actions.listWorkflowRunArtifacts({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
run_id: ${{ github.event.workflow_run.id }}, | |
}); | |
var matchArtifact = artifacts.data.artifacts.filter((artifact) => { | |
return artifact.name == "pr" | |
})[0]; | |
var download = await github.actions.downloadArtifact({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
artifact_id: matchArtifact.id, | |
archive_format: 'zip', | |
}); | |
fs.writeFileSync('${{github.workspace}}/pr.zip', Buffer.from(download.data)); | |
# Unzip the artifacts. | |
- name: Unzip artifact | |
if: ${{ github.event_name == 'workflow_run' }} | |
run: unzip pr.zip | |
# Save the PR number to send messages to the user that opened it. | |
- name: Save PR number | |
if: ${{ github.event_name == 'workflow_run' }} | |
id: pr_number | |
run: echo '::set-output name=PR_NUMBER::'$(cat NR) | |
# Send an information message to the user that opened the pull request. | |
- name: Send information message | |
if: ${{ github.event_name == 'workflow_run' }} | |
uses: actions/github-script@v3.1.0 | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
script: | | |
var issue_number = ${{ steps.pr_number.outputs.PR_NUMBER }}; | |
await github.issues.createComment({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
issue_number: issue_number, | |
body: `The compilation is starting. Take a look [here](https://github.com/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}).` | |
}); | |
# If this workflow was triggered by a push event, it will download the | |
# repository with the changes. | |
- name: Checkout repo | |
if: ${{ github.event_name == 'push' }} | |
uses: actions/checkout@v3 | |
with: | |
submodules: 'true' | |
- name: Setup node | |
uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ matrix.version }} | |
- name: Download Python Deps | |
run: pip install -r resources/scripts/requirements.txt | |
working-directory: ./rticonnextdds-connector | |
- name: Download libs | |
run: python3 resources/scripts/download_latest_libs.py --storage-url ${{ secrets.RTI_AWS_BUCKET }} --storage-path ${{ secrets.RTI_AWS_PATH }} -o . | |
working-directory: ./rticonnextdds-connector | |
env: | |
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
- name: Install node dependencies | |
run: npm install | |
- name: Run Tests | |
run: npm run test-json | |
- uses: dorny/test-reporter@v1 | |
if: always() | |
with: | |
name: Tests results | |
path: 'test-results.json' | |
reporter: mocha-json | |
publish: | |
runs-on: ubuntu-latest | |
name: Publish Connector JS | |
if: startsWith(github.ref, 'refs/tags/v') | |
steps: | |
- name: Checkout repo | |
uses: actions/checkout@v3 | |
with: | |
submodules: 'true' | |
- name: Download Python Deps | |
run: pip install -r resources/scripts/requirements.txt | |
working-directory: ./rticonnextdds-connector | |
- name: Download libs | |
run: python3 resources/scripts/download_latest_libs.py --storage-url ${{ secrets.RTI_AWS_BUCKET }} --storage-path ${{ secrets.RTI_AWS_PATH }} -o . | |
working-directory: ./rticonnextdds-connector | |
env: | |
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
- name: Publish npm package | |
if: startsWith(github.ref, 'refs/tags/v') | |
run: npm publish | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
commentpr: | |
runs-on: ubuntu-latest | |
needs: build | |
name: Comment PR | |
# This job will be executed if this workflow was triggered by a | |
# workflow_run event even if the build job failed or succeeded. | |
if: ${{ always() && github.event_name == 'workflow_run' }} | |
steps: | |
# This job will create a comment on the Pull Request reporting if the | |
# build finished successfully or failed. | |
- name: Comment on PR | |
if: ${{ github.event_name == 'workflow_run' }} | |
uses: actions/github-script@v3 | |
env: | |
ISSUE_NUMBER: ${{ needs.build.outputs.pr_number }} | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
script: | | |
var message; | |
if ('${{ needs.build.result }}' == 'success') | |
message = 'Everything is OK. Thank you for the PR!'; | |
else | |
message = 'Oops, something went wrong!'; | |
var issue_number = ${{ needs.build.outputs.pr_number }}; | |
await github.issues.createComment({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
issue_number: issue_number, | |
body: message, | |
}); |