Skip to content

feat: Publish documentation to public distribution #64

feat: Publish documentation to public distribution

feat: Publish documentation to public distribution #64

name: Generate Documentation
on:
# push:
# tags:
# - '0.0.*'
pull_request:
# release:
# types: [published]
permissions:
id-token: write
jobs:
generate-docs:
strategy:
matrix:
# Use strategy to split up the work into 32 jobs
# job: [0, 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]
job: [0, 1, 2, 3]
runs-on: ubuntu-latest
container: swift:5.9-jammy
env:
IGNORE: xxx
steps:
- name: Checkout Sources
uses: actions/checkout@v2
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: ${{ secrets.CD_API_REFS_PUBLISH_ROLE_ARN }}
aws-region: us-east-1
- name: Install AWS CLI, jq, and native dependencies
run: |
DEBIAN_FRONTEND="noninteractive" apt-get update
apt-get -y install curl unzip openssl libssl-dev jq
curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
unzip awscliv2.zip && ./aws/install
- name: Display user
run: aws sts get-caller-identity
- name: Extract version from GITHUB_REF
id: update-version
run: |
if [[ $GITHUB_REF == refs/tags/* ]]; then
echo "Tagged release"
# get last part of GITHUB_REF separated by /
VERSION=$(echo $GITHUB_REF | tr '/' '\n' | tail -1)
echo "Version: $VERSION"
echo "VERSION=$VERSION" >> "$GITHUB_ENV"
else
# echo "Error: runs on a tag only"
# exit(1)
VERSION="0.0.4"
echo "Assumed version number $VERSION"
echo "VERSION=$VERSION" >> "$GITHUB_ENV"
fi
- name: Generate docs
run: |
DOCS_BUCKET=${{ secrets.CD_API_REFS_BUCKET_NAME }} \
DISTRIBUTION_ID=${{ secrets.CD_CLOUDFRONT_DISTRIBUTION_ID }} \
./scripts/generatedocc.sh "$VERSION" ${{ matrix.job }} ${{ strategy.job-total }} ${{ env.IGNORE }}
update-latest:
needs: generate-docs
runs-on: ubuntu-latest
steps:
- name: Install AWS CLI
run: |
DEBIAN_FRONTEND="noninteractive" apt-get update
apt-get -y install curl unzip
curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
unzip awscliv2.zip && ./aws/install
- name: Update Cloudfront key value store
run: |
aws cloudfront-keyvaluestore --kvs-arn ${{ secrets.CF_CLOUDFRONT_KVS_ARN }} --key latest --value "$VERSION"