Skip to content
This repository was archived by the owner on Apr 18, 2024. It is now read-only.

Commit 3c77159

Browse files
ci: SRE-471: Publish tags from LSF repo to LS (#1276)
1 parent 5eb91e6 commit 3c77159

File tree

1 file changed

+95
-0
lines changed

1 file changed

+95
-0
lines changed
Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
name: "Docs: Build and Commit to LS"
2+
3+
on:
4+
workflow_call:
5+
workflow_dispatch:
6+
7+
env:
8+
LSF_DIR: 'label-studio-frontend'
9+
TARGET_REPO: 'heartexlabs/label-studio'
10+
LS_DIR: 'label-studio'
11+
NODE: '14'
12+
CACHE_NAME_PREFIX: v1
13+
14+
jobs:
15+
build-and-commit-docs:
16+
runs-on: ubuntu-latest
17+
permissions:
18+
contents: write
19+
steps:
20+
- uses: hmarr/[email protected]
21+
22+
- name: Checkout LSF
23+
uses: actions/checkout@v3
24+
with:
25+
token: ${{ secrets.GIT_PAT }}
26+
fetch-depth: 1
27+
path: ${{ env.LSF_DIR }}
28+
29+
- uses: actions/setup-node@v3
30+
with:
31+
node-version: "${{ env.NODE }}"
32+
33+
- name: Cache node modules
34+
uses: actions/cache@v3
35+
with:
36+
path: ~/.npm
37+
key: npm-${{ env.CACHE_NAME_PREFIX }}-${{ runner.os }}-node-${{ env.NODE }}-jsdoc-to-markdown
38+
39+
- name: Install NPM deps
40+
working-directory: ${{ env.LSF_DIR }}/scripts
41+
run: npm install jsdoc-to-markdown node-fetch
42+
43+
- name: Build docs
44+
working-directory: ${{ env.LSF_DIR }}/scripts
45+
run: node create-docs.js
46+
47+
- name: Get GitHub user details
48+
id: get-github-user
49+
uses: actions/github-script@v6
50+
env:
51+
ACTOR_USERNAME: ${{ github.event.sender.login }}
52+
with:
53+
github-token: ${{ secrets.GIT_PAT }}
54+
script: |
55+
const actor_username = process.env.ACTOR_USERNAME;
56+
57+
let user_name = 'robot-ci-heartex';
58+
let user_email = '[email protected]';
59+
60+
try {
61+
const {data: user} = await github.rest.users.getByUsername({
62+
username: actor_username,
63+
});
64+
user_name = user.login;
65+
user_email = user.email;
66+
} catch (e) {
67+
console.log(e)
68+
}
69+
70+
core.setOutput('user_name', user_name);
71+
core.setOutput('user_email', user_email);
72+
73+
- name: Configure git
74+
shell: bash
75+
run: |
76+
set -xeuo pipefail
77+
git config --global user.name '${{ steps.get-github-user.outputs.user_name }}'
78+
git config --global user.email '${{ steps.get-github-user.outputs.user_email }}'
79+
80+
- name: Checkout LS
81+
uses: actions/checkout@v3
82+
with:
83+
token: ${{ secrets.GIT_PAT }}
84+
fetch-depth: 1
85+
repository: ${{ env.TARGET_REPO }}
86+
path: ${{ env.LS_DIR }}
87+
88+
- name: Commit docs
89+
working-directory: ${{ env.LS_DIR }}
90+
run: |
91+
cp -Rf ${GITHUB_WORKSPACE}/${{ env.LSF_DIR }}/docs/* ${GITHUB_WORKSPACE}/${{ env.LS_DIR }}/docs/source/tags/
92+
git status
93+
git add .
94+
git commit -m 'docs: LSF Update'
95+
git push origin

0 commit comments

Comments
 (0)