-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathactions-dev-kit-deploy-docs.yml
More file actions
58 lines (54 loc) · 2.33 KB
/
actions-dev-kit-deploy-docs.yml
File metadata and controls
58 lines (54 loc) · 2.33 KB
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
name: adk-deploy-docs
on: [workflow_dispatch]
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SSH_PUBLIC_KEY: ${{ secrets.SSH_PUBLIC_KEY }}
SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }}
GIT_COMMITTER_NAME: ActionsDevKitRelease
GIT_COMMITTER_EMAIL: cawsactionextensions+adk-release@amazon.com
jobs:
generate-docs:
permissions: write-all
runs-on: ubuntu-latest
steps:
# Allows bot user to push to the main branch
- name: Git & SSH auth setup
run: |
sudo git config --system --add safe.directory "*"
if [[ -n $SSH_PUBLIC_KEY && -n $SSH_PRIVATE_KEY ]]; then
echo "SSH Key pair found, configuring signing..."
mkdir ~/.ssh
echo -e "$SSH_PRIVATE_KEY" >> ~/.ssh/signing_key
cat ~/.ssh/signing_key
echo -e "$SSH_PUBLIC_KEY" >> ~/.ssh/signing_key.pub
cat ~/.ssh/signing_key.pub
chmod 600 ~/.ssh/signing_key && chmod 600 ~/.ssh/signing_key.pub
eval "$(ssh-agent)"
ssh-add ~/.ssh/signing_key
git config --global gpg.format ssh
git config --global user.signingKey ~/.ssh/signing_key
git config --global commit.gpgsign true
git config --global user.email $GIT_COMMITTER_EMAIL
git config --global user.name $GIT_COMMITTER_NAME
touch ~/.ssh/allowed_signers
echo "$GIT_COMMITTER_EMAIL $SSH_PUBLIC_KEY" > ~/.ssh/allowed_signers
git config --global gpg.ssh.allowedSignersFile ~/.ssh/allowed_signers
fi
# Checkout main branch
- uses: actions/checkout@v4
with:
ref: ${{ github.base_ref }}
# Checkout with ssh key to be able to push changes back to the branch
ssh-key: ${{ env.SSH_PRIVATE_KEY }}
# Install dependencies
- run: npm install --global lerna@5.0.0 yarn@1.22.18
- run: lerna --version
- run: yarn --version
- run: npm --version
- run: yarn install # install dependencies
- run: yarn run all #build
- run: yarn run api-ref #generate /docs
# Commit /docs folder back to the main branch. GitHub then deploys it automatically to GitHub pages
- run: git status && git add . && git add -f docs
- run: 'git commit -m "chore(docs): - update API reference"'
- run: git push