Skip to content

[R2R] Add draft docs for sign_raw_transaction #52

[R2R] Add draft docs for sign_raw_transaction

[R2R] Add draft docs for sign_raw_transaction #52

name: Get file and author data, validate and update internal links, deploy
on:
push:
branches: ["dev"]
pull_request:
types: [opened, edited, synchronize, reopened, ready_for_review]
jobs:
pre_job:
# continue-on-error: true # Uncomment once integration is finished
runs-on: ubuntu-latest
# Map a step output to a job output
outputs:
should_skip: ${{ steps.skip_check.outputs.should_skip }}
steps:
- id: skip_check
uses: fkirc/skip-duplicate-actions@v5
with:
# All of these options are optional, so you can remove them if you are happy with the defaults
concurrent_skipping: "never"
skip_after_successful_duplicate: "true"
do_not_skip: '["pull_request"]'
update_lint_get_data:
needs: pre_job
if: needs.pre_job.outputs.should_skip != 'true' && startsWith(github.head_ref, 'lint-fix-patches') == false && github.event.pull_request.head.repo.full_name == github.repository
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
ref: ${{ github.head_ref }}
fetch-depth: 0
- uses: actions/setup-node@v3
with:
node-version: "16"
- name: Cache dependencies
uses: actions/cache@v3
with:
path: ~/.npm
key: npm-${{ hashFiles('package-lock.json') }}
restore-keys: npm-
- name: Generate configs
shell: bash
run: ${GITHUB_WORKSPACE}/utils/gen_api_methods_table.py
- name: Install dependencies
shell: bash
run: cd utils/js && npm ci
- name: Get file and Author data
run: node utils/js/get_file_author_data.js
- name: Validate and Update links
run: node utils/js/validate_update_internal_links_userpass.js
- name: Check presence of file and dirs
run: node utils/js/file_presence_structure_checker.js
- name: Verify h1 is present in every file
run: node utils/js/h1_presence_checker.js
- name: Set lint-fix branch name
id: vars
shell: bash
run: |
BRANCH_NAME="${{ github.head_ref || github.ref }}"
BRANCH_NAME=${BRANCH_NAME#refs/heads/}
echo "BRANCH_NAME=$BRANCH_NAME" >> $GITHUB_OUTPUT
lint_branch_name="lint-fix-patches/${BRANCH_NAME}"
echo "lint_branch_name=$lint_branch_name" >> $GITHUB_OUTPUT
- name: Check if diff exists
id: diff_check
run: |
if git diff --quiet; then
echo "NO_DIFF=true" >> $GITHUB_OUTPUT
else
echo "NO_DIFF=false" >> $GITHUB_OUTPUT
fi
- name: Create Pull Request
uses: peter-evans/create-pull-request@v5
with:
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: "[Bot] File and author data updated, validated and updated internal links, formatted md content, checked presence of file and dirs based on sidebar, checked presence of h1 in every file, update atomicdex methods table"
committer: GitHub <[email protected]>
author: ${{ github.actor }} <${{ github.actor }}@users.noreply.github.com>
branch: ${{ steps.vars.outputs.lint_branch_name}}
delete-branch: true
title: "[BOT] PR to ${{ steps.vars.outputs.branch_name}}. Lints file structure, file contents, gets author data, Updates AtomicDEX API Methods Table"
body: |
- File and author data updated, validated and updated internal links, formatted md content, checked presence of file and dirs based on sidebar, checked presence of h1 in every file, AtomicDEX API Methods Table auto-generated
labels: |
autogenerated
reviewers: smk762, gcharang
draft: false
outputs:
NO_DIFF: ${{ steps.diff_check.outputs.NO_DIFF}}
LINT_BRANCH: ${{ steps.vars.outputs.lint_branch_name}}
BRANCH: ${{ steps.vars.outputs.BRANCH_NAME}}
web_build_and_preview:
needs: update_lint_get_data
name: Build and deploy
runs-on: ubuntu-latest
timeout-minutes: 45
steps:
- name: Extract branch name of mdx repo
shell: bash
run: |
BRANCH_NAME="${{ github.head_ref || github.ref }}"
BRANCH_NAME=${BRANCH_NAME#refs/heads/} # remove the refs/heads/ prefix
echo "BRANCH_NAME=${BRANCH_NAME}" >> $GITHUB_OUTPUT
id: get_branch
- name: Shortify commit sha
shell: bash
run: |
echo "sha_short=$(echo ${GITHUB_SHA::7})" >> $GITHUB_OUTPUT
id: shortify_commit
- name: Checkout code
uses: actions/checkout@v3
with:
ssh-key: ${{ secrets.DOCS_UI_SSH_PRIVATE_KEY }}
repository: KomodoPlatform/website-komodo-docs
ref: main
submodules: recursive
fetch-depth: 0
- name: Get updated content (without diff)
if: needs.update_lint_get_data.outputs.NO_DIFF == 'true'
run: |
cd utils
./update_mdx_branch.sh ${{ needs.update_lint_get_data.outputs.BRANCH }}
cd ..
./update-content.sh
- name: Get updated content (with diff)
if: needs.update_lint_get_data.outputs.NO_DIFF == 'false'
run: |
cd utils
./update_mdx_branch.sh ${{ needs.update_lint_get_data.outputs.LINT_BRANCH }}
cd ..
./update-content.sh
- uses: actions/setup-node@v3
with:
node-version: "16.14"
cache: yarn
- name: Restore cache
uses: actions/cache@v3
with:
path: |
.next/cache
# Generate a new cache whenever packages or source files change.
key:
nextjs-${{ hashFiles('**/package-lock.json', '**/yarn.lock') }}-${{ hashFiles('**.[jt]s', '**.[jt]sx') }}
# If source files changed but packages didn't, rebuild from a prior cache.
restore-keys: nextjs-${{ hashFiles('**/package-lock.json', '**/yarn.lock') }}-
- name: Install build deps
run: yarn install
- name: Build
run: yarn export:cfp
- name: Add no-index headers before pubishing to cloudflare
run: |
echo -e "https://:project.pages.dev/*\n X-Robots-Tag: noindex" > ./out/_headers
- name: Publish to Cloudflare Pages
uses: cloudflare/pages-action@v1
id: cf_publish
with:
apiToken: ${{ secrets.CF_API_TOKEN }}
accountId: ${{ secrets.CF_ACCOUNT_ID }}
projectName: komodo-docs
directory: ./out
gitHubToken: ${{ secrets.GITHUB_TOKEN }}
wranglerVersion: "3"
branch: ${{ steps.get_branch.outputs.BRANCH_NAME }}
- name: Post CF preview url
uses: actions/github-script@v6
if: github.event_name == 'pull_request'
with:
script: |
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: "Preview for merge commit: ${{ steps.shortify_commit.outputs.sha_short }}, available on cloudflare at: ${{ steps.cf_publish.outputs.url }}/en/docs/"
})