This repository was archived by the owner on Apr 18, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 323
95 lines (80 loc) · 2.76 KB
/
Copy pathrelease-set-version.yml
File metadata and controls
95 lines (80 loc) · 2.76 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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
name: "Docs: Build and Commit to LS"
on:
workflow_call:
workflow_dispatch:
env:
LSF_DIR: 'label-studio-frontend'
TARGET_REPO_NAME: 'label-studio'
LS_DIR: 'label-studio'
NODE: '18'
CACHE_NAME_PREFIX: v1
jobs:
build-and-commit-docs:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: hmarr/debug-action@v3.0.0
- name: Checkout LSF
uses: actions/checkout@v4
with:
token: ${{ secrets.GIT_PAT }}
fetch-depth: 1
path: ${{ env.LSF_DIR }}
- uses: actions/setup-node@v4
with:
node-version: "${{ env.NODE }}"
- name: Cache node modules
uses: actions/cache@v4
with:
path: ~/.npm
key: npm-${{ env.CACHE_NAME_PREFIX }}-${{ runner.os }}-node-${{ env.NODE }}-jsdoc-to-markdown
- name: Install NPM deps
working-directory: ${{ env.LSF_DIR }}/scripts
run: npm install jsdoc-to-markdown node-fetch
- name: Build docs
working-directory: ${{ env.LSF_DIR }}/scripts
run: node create-docs.js
- name: Get GitHub user details
id: get-github-user
uses: actions/github-script@v7
env:
ACTOR_USERNAME: ${{ github.event.sender.login }}
with:
github-token: ${{ secrets.GIT_PAT }}
script: |
const actor_username = process.env.ACTOR_USERNAME;
let user_name = 'robot-ci-heartex';
let user_email = 'robot-ci-heartex@users.noreply.github.com';
try {
const {data: user} = await github.rest.users.getByUsername({
username: actor_username,
});
user_name = user.login;
user_email = user.email;
} catch (e) {
console.log(e)
}
core.setOutput('user_name', user_name);
core.setOutput('user_email', user_email);
- name: Configure git
shell: bash
run: |
set -xeuo pipefail
git config --global user.name '${{ steps.get-github-user.outputs.user_name }}'
git config --global user.email '${{ steps.get-github-user.outputs.user_email }}'
- name: Checkout LS
uses: actions/checkout@v4
with:
token: ${{ secrets.GIT_PAT }}
fetch-depth: 1
repository: "${{ github.repository_owner }}/${{ env.TARGET_REPO_NAME }}"
path: ${{ env.LS_DIR }}
- name: Commit docs
working-directory: ${{ env.LS_DIR }}
run: |
cp -Rf ${GITHUB_WORKSPACE}/${{ env.LSF_DIR }}/docs/* ${GITHUB_WORKSPACE}/${{ env.LS_DIR }}/docs/source/tags/
git status
git add .
git commit -m 'docs: LSF Update'
git push origin