dae/.github/workflows/sync-docs.yml
Markson Hon 88d3629c5f
ci: update ci modules using nodejs to latest (#465)
Co-authored-by: Markson Hon <markson@nixos.local>
Co-authored-by: Markson Hon <markson@localhost.lan>
2024-03-02 19:26:46 +08:00

111 lines
3.4 KiB
YAML

name: Synchronize Documents
on:
workflow_dispatch:
push:
branches:
- main
- 'ci/**'
- 'release/**'
tags:
- 'v*'
paths:
- "README*.md"
- "docs/**"
- "example.dae"
- "package.json"
- ".autocorrectrc"
- ".markdownlint-cli2.jsonc"
- '.github/workflows/sync-docs.yml'
jobs:
check-docs:
name: Check document
uses: ./.github/workflows/check-docs.yml
replicate-config:
needs: [check-docs]
name: Replicate relevant document
runs-on: ubuntu-latest
outputs:
git_sha_long: ${{ steps.export.outputs.git_sha_long }}
git_sha_short: ${{ steps.export.outputs.git_sha_short }}
git_commit_msg: ${{ steps.export.outputs.git_commit_msg }}
git_run_number: ${{ steps.export.outputs.git_run_number }}
steps:
- uses: actions/checkout@v4
- name: Get metadata from HEAD sha
id: export
run: |
echo "git_sha_long=${{ github.sha }}" >> $GITHUB_OUTPUT
echo "git_sha_short=$(echo ${{ github.sha }} | cut -c1-6)" >> $GITHUB_OUTPUT
echo "git_commit_msg=$(git log --format=%s -n 1 ${{ github.sha }})" >> $GITHUB_OUTPUT
echo "git_run_number=${{ github.run_number }}" >> $GITHUB_OUTPUT
- name: Generate artifacts
run: |
python3 hack/ci/config-doc-generator.py
- name: Export artifacts
uses: actions/upload-artifact@v4
with:
name: pre_flight_artifacts
path: |
./docs/sync/*.md
sync-to-dae-docs:
needs: [replicate-config]
name: Synchronize changes to dae-docs
runs-on: ubuntu-latest
steps:
- name: Checkout to daeuniverse/dae-docs
uses: actions/checkout@v4
with:
repository: daeuniverse/dae-docs
fetch-depth: 0
ref: master
- name: Copy artifacts from build job to local path
uses: actions/download-artifact@v4.1.4
with:
name: pre_flight_artifacts
path: docs/
- name: Create commits
run: |
git config user.name 'daebot'
git config user.email 'daebot@users.noreply.github.com'
git ls-files --others --exclude-standard -- "*.md"
git add "*.md"
git commit -m "ci(auto-release): push proposed documentation changes from upstream dae project"
- name: Create Pull Request
id: create_pr
uses: peter-evans/create-pull-request@v5
with:
author: daebot <dae@v2raya.org>
committer: daebot <dae@v2raya.org>
token: ${{ secrets.GH_TOKEN }}
signoff: false
branch: automated-pr-sync
delete-branch: true
title: 'ci(auto-release): sync changes from upstream'
body: |
## Summary
Update documentation - Auto-generated by [${{ github.repository }} #${{ needs.replicate-config.outputs.git_run_number }}](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}) @daebot
Commit message: ${{ needs.replicate-config.outputs.git_commit_msg }}
## Context
🏗 daeuniverse/dae(${{ needs.replicate-config.outputs.git_sha_short }}): Build [#${{ needs.replicate-config.outputs.git_run_number }}](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}) succeeded!
labels: |
automated-pr
assignees: daebot
team-reviewers: |
docs
draft: false