feat: add CI/CD workflow automation
All checks were successful
Build and Push to ACR / Build and Push (push) Successful in 3m58s
All checks were successful
Build and Push to ACR / Build and Push (push) Successful in 3m58s
This commit is contained in:
51
.gitea/workflows/techdocs.yml
Normal file
51
.gitea/workflows/techdocs.yml
Normal file
@@ -0,0 +1,51 @@
|
||||
name: Build and Publish TechDocs
|
||||
|
||||
on:
|
||||
workflow_run:
|
||||
workflows: ["Build and Push to ACR"]
|
||||
branches: [main]
|
||||
types: [completed]
|
||||
workflow_dispatch: {}
|
||||
|
||||
env:
|
||||
AZURE_FEDERATED_TOKEN_FILE: /var/run/secrets/azure/tokens/azure-identity-token
|
||||
AZURE_ACCOUNT_NAME: "bstagecjotdevsttechdocs"
|
||||
ENTITY_NAMESPACE: default
|
||||
ENTITY_KIND: component
|
||||
ENTITY_NAME: mohamed-node-mod-1
|
||||
|
||||
jobs:
|
||||
build-and-publish:
|
||||
if: ${{ github.event.workflow_run.conclusion == 'success' || github.event_name == 'workflow_dispatch' }}
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: read
|
||||
id-token: write
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
apt-get update -qq && apt-get install -y python3-pip
|
||||
pip3 install mkdocs-techdocs-core==1.*
|
||||
npm install -g @techdocs/cli
|
||||
- name: Build TechDocs site
|
||||
run: techdocs-cli generate --source-dir . --output-dir ./site --no-docker --verbose
|
||||
- name: Install Azure CLI
|
||||
run: |
|
||||
if ! command -v az &>/dev/null; then curl -sL https://aka.ms/InstallAzureCLIDeb | bash; fi
|
||||
- name: Azure login (OIDC)
|
||||
run: |
|
||||
az login \
|
||||
--service-principal \
|
||||
--username "$AZURE_CLIENT_ID" \
|
||||
--tenant "$AZURE_TENANT_ID" \
|
||||
--federated-token "$(cat $AZURE_FEDERATED_TOKEN_FILE)"
|
||||
- name: Publish TechDocs site
|
||||
run: |
|
||||
techdocs-cli publish \
|
||||
--publisher-type azureBlobStorage \
|
||||
--storage-name "techdocs" \
|
||||
--azureAccountName "$AZURE_ACCOUNT_NAME" \
|
||||
--entity "$ENTITY_NAMESPACE/$ENTITY_KIND/$ENTITY_NAME"
|
||||
Reference in New Issue
Block a user