From b6262707b908da4fdd0af572be86c4da28ebbe99 Mon Sep 17 00:00:00 2001 From: Dr-Electron Date: Tue, 10 Oct 2023 00:00:03 +0200 Subject: [PATCH 1/2] Add first draft of upload workflow --- .github/workflows/upload-docs.yml | 25 +++++++++++++++++++++++++ .gitignore | 3 +++ bindings/python/pydoc-markdown.yml | 2 +- 3 files changed, 29 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/upload-docs.yml diff --git a/.github/workflows/upload-docs.yml b/.github/workflows/upload-docs.yml new file mode 100644 index 0000000000..ef103867ee --- /dev/null +++ b/.github/workflows/upload-docs.yml @@ -0,0 +1,25 @@ +name: Build and upload API docs + +on: + push: + branches: [develop, staging] + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Build python docs + run: | + cd bindings/python + pip install -r requirements-dev.txt + PYTHONPATH=. pydoc-markdown + cd - + - name: Build nodejs docs + run: | + cd bindings/nodejs + # The SDK still uses yarn classic: https://github.com/iotaledger/iota-sdk/issues/433 + yarn set version classic + yarn + yarn create-api-docs --out ../../docs/references/nodejs + cd - \ No newline at end of file diff --git a/.gitignore b/.gitignore index 5fa9b9b946..3bc0e5a494 100644 --- a/.gitignore +++ b/.gitignore @@ -30,3 +30,6 @@ address.json .DS_Store book .venv* + +# Temporary documentation +/docs diff --git a/bindings/python/pydoc-markdown.yml b/bindings/python/pydoc-markdown.yml index a68672a764..0b3ed48b6a 100644 --- a/bindings/python/pydoc-markdown.yml +++ b/bindings/python/pydoc-markdown.yml @@ -8,7 +8,7 @@ processors: - type: crossref renderer: type: docusaurus - docs_base_path: ./docs/ + docs_base_path: ../../docs/ relative_output_path: references/python markdown: From dca5290fbf07e5159508c6a4fa24484187329d8f Mon Sep 17 00:00:00 2001 From: Dr-Electron Date: Fri, 13 Oct 2023 16:06:50 +0200 Subject: [PATCH 2/2] Update action --- .github/workflows/upload-docs.yml | 63 +++++++++++++++++++++++++++--- bindings/python/pydoc-markdown.yml | 2 +- 2 files changed, 58 insertions(+), 7 deletions(-) diff --git a/.github/workflows/upload-docs.yml b/.github/workflows/upload-docs.yml index ef103867ee..9d367dbc58 100644 --- a/.github/workflows/upload-docs.yml +++ b/.github/workflows/upload-docs.yml @@ -1,25 +1,76 @@ name: Build and upload API docs on: - push: - branches: [develop, staging] + release: + types: [published] jobs: build: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 + + - name: Set up Rust + uses: ./.github/actions/setup-rust + with: + cache-root: bindings/nodejs + + - name: Set Up Node.js 18 and Yarn Cache + uses: actions/setup-node@v3 + with: + node-version: "18" + cache: yarn + cache-dependency-path: bindings/nodejs/yarn.lock + + - name: Install Required Dependencies (Ubuntu) + run: | + sudo apt-get update + sudo apt-get install libudev-dev libusb-1.0-0-dev + + - name: Echo tag + run: echo ${{ github.ref }} + + - name: Get release language + id: get_release_language + run: | + if [[ ${{ github.ref }} == *"python"* ]]; then + echo LANGUAGE="python" >> $GITHUB_OUTPUT + fi + if [[ ${{ github.ref }} == *"nodejs"* ]]; then + echo LANGUAGE="nodejs" >> $GITHUB_OUTPUT + fi + - name: Get release version + id: get_release_version + run: | + VERSION=$(echo ${{ github.ref }} | sed -e 's/.*v\([0-9]*\.[0-9]*\).*/\1/') + echo VERSION=$VERSION >> $GITHUB_OUTPUT + - name: Build python docs + if: steps.get_release_language.outputs.LANGUAGE == 'python' run: | cd bindings/python pip install -r requirements-dev.txt PYTHONPATH=. pydoc-markdown - cd - + cd - + - name: Build nodejs docs + if: steps.get_release_language.outputs.LANGUAGE == 'nodejs' run: | cd bindings/nodejs # The SDK still uses yarn classic: https://github.com/iotaledger/iota-sdk/issues/433 yarn set version classic yarn - yarn create-api-docs --out ../../docs/references/nodejs - cd - \ No newline at end of file + yarn create-api-docs --out ../../docs/nodejs + cd - + + - name: Compress generated docs + run: | + tar czvf ${{ steps.get_release_language.outputs.LANGUAGE }}.tar.gz docs/* + + - name: Upload docs to AWS S3 + env: + AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID_IOTA_WIKI }} + AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY_IOTA_WIKI }} + AWS_DEFAULT_REGION: "eu-central-1" + run: | + aws s3 cp ${{ steps.get_release_language.outputs.LANGUAGE }}.tar.gz s3://files.iota.org/iota-wiki/iota-sdk/${{ steps.get_release_version.outputs.VERSION }}/ --acl public-read diff --git a/bindings/python/pydoc-markdown.yml b/bindings/python/pydoc-markdown.yml index 0b3ed48b6a..b4d9242ef0 100644 --- a/bindings/python/pydoc-markdown.yml +++ b/bindings/python/pydoc-markdown.yml @@ -9,7 +9,7 @@ processors: renderer: type: docusaurus docs_base_path: ../../docs/ - relative_output_path: references/python + relative_output_path: python markdown: use_fixed_header_levels: true