Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add first draft of upload workflow #1412

Merged
merged 8 commits into from
Oct 23, 2023
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
84 changes: 84 additions & 0 deletions .github/workflows/upload-docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
name: Build and upload API docs

on:
release:
types: [published]

env:
GH_TOKEN: ${{ github.token }}

permissions:
actions: 'write'

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- 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: Check if release language is supported
if: steps.get_release_language.outputs.LANGUAGE != 'python' && steps.get_release_language.outputs.LANGUAGE != 'nodejs'
run: gh run cancel ${{ github.run_id }}

- name: Set up Rust
uses: ./.github/actions/setup-rust
with:
cache-root: bindings/nodejs
Dr-Electron marked this conversation as resolved.
Show resolved Hide resolved

- 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
Dr-Electron marked this conversation as resolved.
Show resolved Hide resolved

- name: Install Required Dependencies (Ubuntu)
run: |
sudo apt-get update
sudo apt-get install libudev-dev libusb-1.0-0-dev

- name: Get release version
id: get_release_version
run: |
VERSION=$(echo ${{ github.ref }} | sed -e 's/.*v\([0-9]*\.[0-9]*\).*/\1/')
thibault-martinez marked this conversation as resolved.
Show resolved Hide resolved
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 -

- 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/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
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,6 @@ address.json
.DS_Store
book
.venv*

# Temporary documentation
docs
4 changes: 2 additions & 2 deletions bindings/python/pydoc-markdown.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ processors:
- type: crossref
renderer:
type: docusaurus
docs_base_path: ./docs/
relative_output_path: references/python
docs_base_path: ../../docs/
relative_output_path: python

markdown:
use_fixed_header_levels: true
Expand Down