-
Notifications
You must be signed in to change notification settings - Fork 41
80 lines (66 loc) · 2.5 KB
/
upload-docs.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
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
- name: Set Up Node.js 18 and Yarn Cache
uses: actions/setup-node@v3
with:
node-version: "18"
- 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/')
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