sdk-update #70
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: test-docs-examples-2 | |
on: | |
repository_dispatch: | |
types: [ sdk-update ] | |
jobs: | |
code_examples: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Setup Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version-file: '.nvmrc' | |
cache: 'yarn' | |
- name: Get current package version | |
working-directory: code_examples/sdk_examples/ | |
id: kiltprotocol_sdk | |
run: echo "current_tag=$(grep kiltprotocol/sdk-js package.json | awk -F \" '{print $4}')" >> $GITHUB_OUTPUT | |
- uses: jacobtomlinson/gha-find-replace@v3 | |
with: | |
find: '@kiltprotocol/sdk-js": "${{ steps.kiltprotocol_sdk.outputs.current_tag }}' | |
replace: '@kiltprotocol/sdk-js": "${{ github.event.client_payload.latestTag }}' | |
include: "code_examples/**/*" | |
exclude: "**/*.lock" | |
regex: false | |
- name: Install and dedupe | |
working-directory: code_examples/sdk_examples/ | |
run: | | |
yarn install && npx --yes yarn-dedupe yarn.lock && yarn install | |
- name: Run tests | |
timeout-minutes: 60 | |
working-directory: code_examples/sdk_examples/ | |
env: | |
NODE_OPTIONS: --unhandled-rejections=strict | |
BASE_MNEMONIC: ${{ secrets.BASE_MNEMONIC }} | |
run: | | |
yarn test | |
create_pull_request: | |
runs-on: ubuntu-latest | |
needs: [ code_examples ] | |
if: success() && !contains(github.event.client_payload.latestTag, 'rc') | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Setup Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version-file: '.nvmrc' | |
cache: 'yarn' | |
- name: Get current package version | |
working-directory: code_examples/sdk_examples/ | |
id: kiltprotocol_sdk | |
run: echo "current_tag=$(grep kiltprotocol/sdk-js package.json | awk -F \" '{print $4}')" >> $GITHUB_OUTPUT | |
- uses: jacobtomlinson/gha-find-replace@v3 | |
with: | |
find: '${{ steps.kiltprotocol_sdk.outputs.current_tag }}' | |
replace: '${{ github.event.client_payload.latestTag }}' | |
include: "docs/**/*.md" | |
regex: false | |
- uses: jacobtomlinson/gha-find-replace@v3 | |
with: | |
find: '@kiltprotocol/sdk-js": "${{ steps.kiltprotocol_sdk.outputs.current_tag }}' | |
replace: '@kiltprotocol/sdk-js": "${{ github.event.client_payload.latestTag }}' | |
include: "code_examples/**/*" | |
exclude: "**/*.lock" | |
regex: false | |
- uses: jacobtomlinson/gha-find-replace@v3 | |
with: | |
find: '@kiltprotocol/sdk-js": "${{ steps.kiltprotocol_sdk.outputs.current_tag }}' | |
replace: '@kiltprotocol/sdk-js": "${{ github.event.client_payload.latestTag }}' | |
include: "scripts/**" | |
exclude: "**/*.lock" | |
regex: false | |
- name: Regenerate yarn lock for SDK examples | |
working-directory: code_examples/sdk_examples | |
run: | | |
yarn install && npx --yes yarn-dedupe yarn.lock && yarn install | |
- name: Regenerate yarn lock for scripts | |
working-directory: scripts | |
run: | | |
yarn install && npx --yes yarn-dedupe yarn.lock && yarn install | |
- name: Create Pull Request | |
uses: peter-evans/create-pull-request@v4 | |
with: | |
token: ${{ secrets.REPO_ACCESS_TOKEN }} | |
base: master | |
delete-branch: true | |
title: '[Chore] Update SDK version to latest' | |
body: | | |
Update SDK version in the docs to the latest version ${{ github.event.client_payload.latestTag }} since it passes compatibility test | |
- Beware ~ CI-generated PR | |
labels: | | |
sdk | |
draft: false | |
add-paths: | | |
*package.json | |
*yarn.lock | |
*.md | |
create_issue: | |
runs-on: ubuntu-latest | |
needs: [ code_examples ] | |
if: failure() | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Generate issue body | |
run: | | |
echo "ISSUE_BODY=[At least one of the test workflows](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}) using the latest released SDK ${{ github.event.client_payload.latestTag }} on docs has failed." >> $GITHUB_ENV | |
- name: Create issue | |
id: issue | |
uses: imjohnbo/issue-bot@v3 | |
with: | |
title: "[AUTOMATIC] New SDK ${{ github.event.client_payload.latestTag }} is incompatible with deployed docs examples" | |
body: | | |
## Incompatible SDK detected | |
${{ env.ISSUE_BODY }} | |
### Tasks | |
- [ ] Check if any docs need to be updated, and if needed do so | |
labels: | | |
:memo: documentation | |
📚 release | |
🧰 sdk | |
🚚 high | |
column: 📥 Inbox | |
assignees: "ntn-x2, rflechtner" | |
token: ${{ secrets.REPO_ACCESS_TOKEN }} | |
project-v2-path: orgs/KILTprotocol/projects/24 |