Repository navigation
78 lines (68 loc) · 2.11 KB
/
Copy pathsync.yml
File metadata and controls
78 lines (68 loc) · 2.11 KB
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
name: Sync docs
on:
repository_dispatch:
types:
- docs-release
workflow_dispatch:
inputs:
project:
description: Project to sync
required: true
type: choice
options:
- ferrum
- cuprite
- vessel
tag:
description: Release tag, e.g. v0.17.0
required: true
permissions:
contents: write
actions: write
concurrency:
group: sync-docs
cancel-in-progress: false
jobs:
sync:
runs-on: ubuntu-latest
env:
PROJECT: ${{ github.event.client_payload.project || inputs.project }}
TAG: ${{ github.event.client_payload.tag || inputs.tag }}
GH_TOKEN: ${{ github.token }}
steps:
- name: Validate input
run: |
case "$PROJECT" in ferrum|cuprite|vessel) ;; *) echo "Unknown project: $PROJECT"; exit 1 ;; esac
[[ "$TAG" =~ ^v[0-9]+(\.[0-9]+)*$ ]] || { echo "Invalid tag: $TAG"; exit 1; }
- name: Checkout
uses: actions/checkout@v5
with:
ref: master
- name: Setup Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: "3.4"
- name: Check out released docs
run: |
git config --global url."https://github.com/".insteadOf git@github.com:
git submodule update --init "projects/$PROJECT"
git -C "projects/$PROJECT" fetch --tags origin
git -C "projects/$PROJECT" checkout "tags/$TAG"
- name: Sync docs
run: rake sync_docs
- name: Commit and push
id: commit
run: |
git add "projects/$PROJECT" docs
if git diff --cached --quiet; then
echo "changed=false" >> "$GITHUB_OUTPUT"
exit 0
fi
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git commit -m "docs($PROJECT): sync docs for $TAG"
git push origin HEAD:master
echo "changed=true" >> "$GITHUB_OUTPUT"
- name: Deploy
if: steps.commit.outputs.changed == 'true'
run: gh workflow run deploy.yml --ref master