maven deployment updates #74
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build and preview documentation | |
on: | |
pull_request: | |
branches: | |
- main | |
- initial | |
jobs: | |
doc-check: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check if PR was merged | |
if: github.event.pull_request.merged != true | |
run: echo "Pull request was not merged — exiting." && exit 0 | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.12' | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install tox | |
- name: get git info | |
id: getgitinfo | |
run: | | |
echo "GITHUB_COMMIT_DATE=$(git --no-pager log -1 --pretty='format:%cd' --date='format:%Y-%m-%d %H:%M:%S')" >> "$GITHUB_OUTPUT" | |
- name: Run Tox for Documentation | |
env: | |
GH_ACTIONS_GIT_BRANCH: ${{ github.head_ref || github.ref_name }} | |
GH_ACTIONS_GIT_COMMIT_DATE: ${{ steps.getgitinfo.outputs.GITHUB_COMMIT_DATE }} | |
GH_ACTIONS_GIT_COMMIT_HASH: ${{ github.sha }} | |
run: tox -e docs | |
- name: Compress documentation into .tar.gz | |
run: | | |
tar -czf docs-html.tar.gz -C doc/build/html . | |
mkdir -p ./library | |
cp docs-html.tar.gz ./library/docs-html.tar.gz | |
cp docs-html.tar.gz playbooks/docs-html.tar.gz | |
- name: Write clouds.yaml | |
run: | | |
mkdir -p ~/.config/openstack | |
cat > ~/.config/openstack/clouds.yaml <<EOF | |
clouds: | |
otc: | |
profile: otc | |
auth: | |
auth_url: https://iam.eu-de.otc.t-systems.com:443/v3 | |
username: ${{ secrets.OTC_AUTH_USERNAME_PREVIEW }} | |
password: ${{ secrets.OTC_AUTH_PASSWORD }} | |
project_name: ${{ secrets.OTC_PROJECT_NAME_PREVIEW }} | |
user_domain_name: ${{ secrets.OTC_DOMAIN }} | |
interface: public | |
identity_api_version: 3 | |
object_store_endpoint_override: ${{ secrets.OTC_ENDPOINT_STORAGE_PREVIEW }} | |
EOF | |
- name: Install dependencies for Swift upload | |
run: | | |
python -m pip install openstacksdk ansible requests requestsexceptions ansible | |
- name: Clone up-to-date upload script | |
run: | | |
curl -sSL -o ./library/upload_artifact_swift.py https://raw.githubusercontent.com/opentelekomcloud-infra/otc-zuul-jobs/refs/heads/main/roles/upload-artifact-swift/library/upload_artifact_swift.py | |
- name: Upload to Swift as preview | |
env: | |
RUN_ID: ${{ github.run_id }} | |
run: | | |
ansible-playbook -i localhost, -M ./library -e "run_id=$RUN_ID" playbooks/upload_swift_preview.yml | |
- name: Comment on PR with container name | |
if: github.event_name == 'pull_request' | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
PREVIEW_URL: "${{ secrets.OTC_ENDPOINT_STORAGE_PREVIEW }}/gh_action_logs/opentelekomcloud-functiongraph-java/${{ github.run_id }}" | |
PR_NUMBER: ${{ github.event.pull_request.number }} | |
run: | | |
COMMENT_BODY="📦 Preview-Documentation uploaded to Swift: ${PREVIEW_URL}/" | |
curl -s -H "Authorization: Bearer $GITHUB_TOKEN" \ | |
-H "Content-Type: application/json" \ | |
-X POST \ | |
-d "{\"body\": \"$COMMENT_BODY\"}" \ | |
"https://api.github.com/repos/${{ github.repository }}/issues/${PR_NUMBER}/comments" |