forked from Moddus/tldr-python-dash-docset
-
Notifications
You must be signed in to change notification settings - Fork 1
64 lines (49 loc) · 2.21 KB
/
update-docset.yml
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
name: Update Docset
on:
schedule:
- cron: '0 0 1 * *'
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Create version environment variable
run: echo "new_version=$(date -u +%Y-%m-%d)" >> $GITHUB_ENV
# Build docset
- name: Checkout code
uses: actions/checkout@v4
- name: Set version number
run: sed -i "s/YYYY-MM-DD/$new_version/" static/Info.plist
- name: Build docset
run: docker compose up
# Create PR
- name: Sync contributions repo
run: gh repo sync cvn/Dash-User-Contributions -b master --force
env:
GITHUB_TOKEN: ${{ secrets.DASH_REPO_TOKEN }}
- name: Checkout code
uses: actions/checkout@v4
with:
repository: cvn/Dash-User-Contributions
token: ${{ secrets.DASH_REPO_TOKEN }}
path: Dash-User-Contributions
- name: Update version number in docset.json
run: |
sed -i "s/\"version\": \".*\"/\"version\": \"$new_version\"/" Dash-User-Contributions/docsets/tldr/docset.json
- name: Move docset
run: mv tldr_pages.tgz Dash-User-Contributions/docsets/tldr/
- name: Commit changes
run: |
cd Dash-User-Contributions
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git checkout -b tldr-update
git add --all .
git commit -m "Update TLDR pages docset to $new_version"
git push --force origin tldr-update
- name: Create pull request to upstream
run: |
cd Dash-User-Contributions
gh pr create --head tldr-update --title "Update TLDR pages docset to $new_version" --body "This is an automated update created by [a workflow](https://github.com/cvn/tldr-python-dash-docset/actions/workflows/update-docset.yml)."
env:
GITHUB_TOKEN: ${{ secrets.DASH_REPO_TOKEN }}