Skip to content

Commit e3fd2cc

Browse files
committed
build: set-output deprecated
1 parent b7681d4 commit e3fd2cc

File tree

3 files changed

+19
-14
lines changed

3 files changed

+19
-14
lines changed

.github/workflows/crowdin-ci.yml

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -44,22 +44,17 @@ jobs:
4444
# Build translations
4545
- name: Build Crowdin project
4646
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
5151

5252
- 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
5954

6055
- name: Check build success
6156
run: |
62-
if [ "${{ steps.build-crowdin.outputs.buildSuccess }}" = "false" ]; then
57+
if [ "$(grep BUILD_SUCCESS output.env | cut -d'=' -f2)" = "false" ]; then
6358
echo "Build timed out, exiting"
6459
exit 1
6560
fi

src/scripts/crowdin/translations/awaitLatestBuild.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,14 @@
1+
import { writeFileSync } from "fs"
2+
import { join } from "path"
3+
14
import crowdin from "../api-client/crowdinClient"
25

36
const FINISHED = "finished"
47
const TIMEOUT = 2 * 60 * 60 * 1000 // Timeout after 2 hours
58
const INTERVAL = 10 * 1000 // 10 seconds between checks
69

10+
const OUTPUT_PATH = join(process.env["GITHUB_WORKSPACE"] || "", "output.env")
11+
712
async function awaitLatestBuild() {
813
const projectId = Number(process.env.CROWDIN_PROJECT_ID) || 363359
914

@@ -37,14 +42,14 @@ async function awaitLatestBuild() {
3742
}
3843

3944
if (data.status !== FINISHED) {
40-
console.error(`::set-output name=buildSuccess::false`)
45+
writeFileSync(OUTPUT_PATH, `BUILD_SUCCESS=false\n`, { flag: "a" })
4146
throw new Error(
4247
`Timeout: Build did not finish in ${TIMEOUT / 1000 / 60} minutes`
4348
)
4449
}
4550

4651
console.log("Latest build data:", data)
47-
console.error(`::set-output name=buildSuccess::true`)
52+
writeFileSync(OUTPUT_PATH, `BUILD_SUCCESS=true\n`, { flag: "a" })
4853
}
4954

5055
awaitLatestBuild()

src/scripts/crowdin/translations/triggerBuild.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
1+
import { writeFileSync } from "fs"
2+
import { join } from "path"
3+
14
import crowdin from "../api-client/crowdinClient"
25

6+
const OUTPUT_PATH = join(process.env["GITHUB_WORKSPACE"] || "", "output.env")
7+
38
async function triggerBuild() {
49
const projectId = Number(process.env.CROWDIN_PROJECT_ID) || 363359
510

@@ -11,7 +16,7 @@ async function triggerBuild() {
1116
`Build ${isAlreadyFinished ? "already finished" : "triggered"} id:`,
1217
id
1318
)
14-
console.log(`::set-output name=buildId::${id}`)
19+
writeFileSync(OUTPUT_PATH, `buildId=${id}\n`, { flag: "a" })
1520
} catch (error: unknown) {
1621
console.error((error as Error).message)
1722
}

0 commit comments

Comments
 (0)