File tree Expand file tree Collapse file tree 4 files changed +929
-5
lines changed
Expand file tree Collapse file tree 4 files changed +929
-5
lines changed Original file line number Diff line number Diff line change 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 }}
Original file line number Diff line number Diff line change 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" : " " ,
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" ,
Original file line number Diff line number Diff line change 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+ )
You can’t perform that action at this time.
0 commit comments