Skip to content

Commit

Permalink
ci: docs synchronization (#103)
Browse files Browse the repository at this point in the history
* Create sync-docs.yml

* feat(ci): add sync-docs.yml

* patch(ci/check-docs): add event-driven trigger

* ci: watch changes made in sync-docs.yml

* ci: re-arrange the order of steps

* ci(check-docs): disable all auto trigger

* ci(sync-docs): update author and commiter to daebot

* fix: apply subtle changes

* ci: apply subtle changes

* ci: test copy functionality

* patch: fix proper naming

* chore: remove dummy line

* ci: watch changes of example.dae

* chore(issue_template): remove unnecessary marks
  • Loading branch information
piyoki authored Jun 2, 2023
1 parent 689fa0f commit 035332a
Show file tree
Hide file tree
Showing 4 changed files with 119 additions and 13 deletions.
6 changes: 3 additions & 3 deletions .github/ISSUE_TEMPLATE/bug-report.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ labels: kind/bug
Please use this template while reporting a bug and provide as much info as possible. Not doing so may result in your bug not being addressed in a timely manner. Thanks!
-->

## What happened:
## What happened

## What you expected to happen:
## What you expected to happen

## How to reproduce it (as minimally and precisely as possible):

## Anything else we need to know

## Environment:
## Environment

- Dae version (use `dae --version`):
- OS (e.g `cat /etc/os-release`):
Expand Down
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/feature-request.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ You may also post your idea on the Discussions or the Dae Telegram channel (http

## What feature you would like us to integrate into the dae project

## Why is this needed:
## Why is this needed
14 changes: 5 additions & 9 deletions .github/workflows/check-docs.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,13 @@
name: Check document

on:
push:
branches: [main]
paths:
- 'README.md'
- 'docs/**'
- 'package.json'
- '.autocorrectrc'
- '.markdownlint-cli2.jsonc'
- '.github/workflows/check-docs.yml'
workflow_dispatch:
workflow_call:
pull_request:
branches: [main]
types:
- opened
- synchronize
paths:
- 'README.md'
- 'docs/**'
Expand Down
110 changes: 110 additions & 0 deletions .github/workflows/sync-docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
name: Synchronize document

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@v3
- 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@v3
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@v3
with:
repository: daeuniverse/dae-docs
fetch-depth: 0
ref: master

- name: Copy artifacts from build job to local path
uses: actions/download-artifact@v3
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

0 comments on commit 035332a

Please sign in to comment.