Skip to content

Commit e8810df

Browse files
committed
update build scripts
1 parent 1d800e9 commit e8810df

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

.github/workflows/main.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,3 +37,4 @@ jobs:
3737
PROJECT_ID: ${{ secrets.PROJECT_ID }}
3838
STORAGE_BUCKET: ${{ secrets.STORAGE_BUCKET }}
3939
GITHUB_REF: ${{ github.ref_name }}
40+
FLAVOR: ${{ github.ref_name }}

tools/scripts/build.js

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ import options from '../../config/prod.animated-java.rollup.config'
33
import fs from 'fs'
44
import crypto from 'crypto'
55
import fixup from '../fixup'
6+
const flavor = process.env.FLAVOR?.split('/').pop()
7+
? 'git-' + process.env.FLAVOR?.split('/').pop()
8+
: `local`
69
;(async () => {
710
const bundle = await rollup.rollup(options)
811
function makeBanner(lines) {
@@ -23,10 +26,10 @@ import fixup from '../fixup'
2326
const licence = fs.readFileSync('./LICENSE', 'utf-8')
2427
for (const chunk of output) {
2528
if (chunk.fileName.endsWith('.js')) {
26-
const id = crypto
27-
.createHash('sha256')
28-
.update(chunk.code)
29-
.digest('hex')
29+
const id =
30+
flavor +
31+
'-' +
32+
crypto.createHash('sha256').update(chunk.code).digest('hex')
3033
fs.writeFileSync(
3134
'./dist/animated_java.js',
3235
[

0 commit comments

Comments
 (0)