File tree Expand file tree Collapse file tree 3 files changed +19
-14
lines changed
src/scripts/crowdin/translations Expand file tree Collapse file tree 3 files changed +19
-14
lines changed Original file line number Diff line number Diff line change @@ -44,22 +44,17 @@ jobs:
44
44
# Build translations
45
45
- name : Build Crowdin project
46
46
id : build-crowdin
47
- run : |
48
- OUTPUT=$(npx ts-node -O '{"module":"commonjs"}' ./src/scripts/crowdin/translations/triggerBuild.ts)
49
- echo "$OUTPUT"
50
- shell : bash
47
+ run : npx ts-node -O '{"module":"commonjs"}' ./src/scripts/crowdin/translations/triggerBuild.ts
48
+
49
+ - name : Load buildId
50
+ run : echo "BUILD_ID=$(cat output.env | grep buildId | cut -d'=' -f2)" >> $GITHUB_ENV
51
51
52
52
- name : Await latest build to finish
53
- env :
54
- BUILD_ID : ${{ steps.build-crowdin.outputs.buildId}}
55
- run : |
56
- OUTPUT=$(npx ts-node -O '{"module":"commonjs"}' ./src/scripts/crowdin/translations/awaitLatestBuild.ts)
57
- echo "$OUTPUT"
58
- shell : bash
53
+ run : npx ts-node -O '{"module":"commonjs"}' ./src/scripts/crowdin/translations/awaitLatestBuild.ts
59
54
60
55
- name : Check build success
61
56
run : |
62
- if [ "${{ steps.build-crowdin.outputs.buildSuccess }} " = "false" ]; then
57
+ if [ "$(grep BUILD_SUCCESS output.env | cut -d'=' -f2) " = "false" ]; then
63
58
echo "Build timed out, exiting"
64
59
exit 1
65
60
fi
Original file line number Diff line number Diff line change
1
+ import { writeFileSync } from "fs"
2
+ import { join } from "path"
3
+
1
4
import crowdin from "../api-client/crowdinClient"
2
5
3
6
const FINISHED = "finished"
4
7
const TIMEOUT = 2 * 60 * 60 * 1000 // Timeout after 2 hours
5
8
const INTERVAL = 10 * 1000 // 10 seconds between checks
6
9
10
+ const OUTPUT_PATH = join ( process . env [ "GITHUB_WORKSPACE" ] || "" , "output.env" )
11
+
7
12
async function awaitLatestBuild ( ) {
8
13
const projectId = Number ( process . env . CROWDIN_PROJECT_ID ) || 363359
9
14
@@ -37,14 +42,14 @@ async function awaitLatestBuild() {
37
42
}
38
43
39
44
if ( data . status !== FINISHED ) {
40
- console . error ( `::set-output name=buildSuccess:: false` )
45
+ writeFileSync ( OUTPUT_PATH , `BUILD_SUCCESS= false\n` , { flag : "a" } )
41
46
throw new Error (
42
47
`Timeout: Build did not finish in ${ TIMEOUT / 1000 / 60 } minutes`
43
48
)
44
49
}
45
50
46
51
console . log ( "Latest build data:" , data )
47
- console . error ( `::set-output name=buildSuccess:: true` )
52
+ writeFileSync ( OUTPUT_PATH , `BUILD_SUCCESS= true\n` , { flag : "a" } )
48
53
}
49
54
50
55
awaitLatestBuild ( )
Original file line number Diff line number Diff line change
1
+ import { writeFileSync } from "fs"
2
+ import { join } from "path"
3
+
1
4
import crowdin from "../api-client/crowdinClient"
2
5
6
+ const OUTPUT_PATH = join ( process . env [ "GITHUB_WORKSPACE" ] || "" , "output.env" )
7
+
3
8
async function triggerBuild ( ) {
4
9
const projectId = Number ( process . env . CROWDIN_PROJECT_ID ) || 363359
5
10
@@ -11,7 +16,7 @@ async function triggerBuild() {
11
16
`Build ${ isAlreadyFinished ? "already finished" : "triggered" } id:` ,
12
17
id
13
18
)
14
- console . log ( `::set-output name= buildId:: ${ id } ` )
19
+ writeFileSync ( OUTPUT_PATH , ` buildId= ${ id } \n` , { flag : "a" } )
15
20
} catch ( error : unknown ) {
16
21
console . error ( ( error as Error ) . message )
17
22
}
You can’t perform that action at this time.
0 commit comments