Skip to content

Commit

Permalink
Update action
Browse files Browse the repository at this point in the history
  • Loading branch information
Dr-Electron committed Oct 13, 2023
1 parent b626270 commit d57219e
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 7 deletions.
63 changes: 57 additions & 6 deletions .github/workflows/upload-docs.yml
Original file line number Diff line number Diff line change
@@ -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: Set language and version
id: releasase_metadata
run: |
if [[ ${{ github.ref }} == *"python"* ]]; then
echo LANGUAGE="python" >> $GITHUB_OUTPUT
fi
if [[ ${{ github.ref }} == *"nodejs"* ]]; then
echo LANGUAGE="python" >> $GITHUB_OUTPUT
fi
# Get the version from the tag. Example: iota-sdk-nodejs-v1.1.1 would result in 1.1
VERSION=$(echo ${{ github.ref }} | sed -e 's/.*v\([0-9]*\.[0-9]*\).*/\1/')
echo VERSION=$VERSION >> $GITHUB_OUTPUT
- name: Build python docs
# Check if the output of set_language contains python
if: steps.releasase_metadata.outputs.LANGUAGE == 'python'
run: |
cd bindings/python
pip install -r requirements-dev.txt
PYTHONPATH=. pydoc-markdown
cd -
cd -
- name: Build nodejs docs
if: steps.releasase_metadata.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 -
yarn create-api-docs --out ../../docs/nodejs
cd -
- name: Compress generated docs
run: |
tar czvf ${{ steps.releasase_metadata.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.releasase_metadata.outputs.LANGUAGE }}.tar.gz s3://files.iota.org/iota-wiki/iota-sdk/${{ steps.releasase_metadata.outputs.VERSION }} --acls public-read
2 changes: 1 addition & 1 deletion bindings/python/pydoc-markdown.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit d57219e

Please sign in to comment.