Skip to content

Commit 6a92a16

Browse files
committed
Merge branch 'main' of https://github.com/Animated-Java/animated-java into experimental
2 parents dcfda71 + 97548d5 commit 6a92a16

File tree

4 files changed

+929
-5
lines changed

4 files changed

+929
-5
lines changed

.github/workflows/main.yml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# This is a basic workflow to help you get started with Actions
2+
3+
name: Build and push to site
4+
5+
on:
6+
push:
7+
branches: [main]
8+
pull_request:
9+
branches: [main]
10+
11+
workflow_dispatch:
12+
13+
jobs:
14+
build:
15+
runs-on: ubuntu-latest
16+
17+
steps:
18+
- uses: actions/checkout@v1
19+
- name: Setup Node.js environment
20+
uses: actions/setup-node@v2.5.1
21+
with:
22+
node-version: 16.x
23+
- name: install yarn
24+
run: npm i -g yarn
25+
- name: run yarn
26+
run: yarn
27+
- name: build release
28+
run: yarn build
29+
- name: create distribution
30+
run: node ./tools/distribute.js ${{ github.ref_name }}
31+
env:
32+
API_KEY: ${{ secrets.API_KEY }}
33+
APP_ID: ${{ secrets.SECRET_KEY }}
34+
AUTH_DOMAIN: ${{ secrets.AUTH_DOMAIN }}
35+
MEASUREMENT_ID: ${{ secrets.MEASUREMENT_ID }}
36+
MESSAGE_SENDER_ID: ${{ secrets.MESSAGE_SENDER_ID }}
37+
PROJECT_ID: ${{ secrets.PROJECT_ID }}
38+
STORAGE_BUCKET: ${{ secrets.STORAGE_BUCKET }}
39+
GITHUB_REF: ${{ github.ref_name }}

package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@
1212
"build:app": "node dist/tools/scripts/build.js",
1313
"build:worker": "rollup --config ./lang-mc-worker/rollup.config.js",
1414
"build": "yarn build:scripts && yarn build:worker && yarn build:app",
15-
"lint": "prettier --write ."
15+
"lint": "prettier --write .",
16+
"ci:upload": "node ./tools/distribute.js"
1617
},
1718
"keywords": [],
1819
"author": "",
@@ -45,9 +46,11 @@
4546
"struct-packer": "^1.0.6"
4647
},
4748
"devDependencies": {
49+
"@actions/core": "^1.6.0",
4850
"@types/node": "^17.0.5",
4951
"@types/three": "^0.135.0",
5052
"blockbench-types": "^4.0.0",
53+
"firebase": "^9.6.1",
5154
"js-yaml": "^4.1.0",
5255
"prettier": "^2.4.1",
5356
"rollup-plugin-typescript2": "^0.30.0",

tools/distribute.js

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
const { initializeApp } = require('firebase/app')
2+
const { getStorage, ref, uploadString } = require('firebase/storage')
3+
const core = require('@actions/core')
4+
console.log(`builds/${process.env.GITHUB_REF.split("/").pop()}/animated_java.js`)
5+
const app = initializeApp({
6+
apiKey: process.env.API_KEY,
7+
authDomain: process.env.AUTH_DOMAIN,
8+
projectId: process.env.PROJECT_ID,
9+
storageBucket: process.env.STORAGE_BUCKET,
10+
messagingSenderId: process.env.MESSAGE_SENDER_ID,
11+
appId: process.env.APP_ID,
12+
measurementId: process.env.MEASUREMENT_ID,
13+
})
14+
const store = getStorage(app)
15+
const build = ref(store, `builds/${process.env.GITHUB_REF.split("/").pop()}/animated_java.js`)
16+
17+
const fs = require('fs')
18+
uploadString(build, fs.readFileSync('./dist/animated_java.js', 'utf8')).then(
19+
(snapshot) => {
20+
console.log(
21+
'Uploaded animated java to ',
22+
`builds/${process.env.GITHUB_REF.split("/").pop()}/animated_java.js`
23+
)
24+
}
25+
)

0 commit comments

Comments
 (0)