File tree Expand file tree Collapse file tree 5 files changed +69
-0
lines changed Expand file tree Collapse file tree 5 files changed +69
-0
lines changed Original file line number Diff line number Diff line change
1
+ root = true
2
+ [* ]
3
+ end_of_line = lf
Original file line number Diff line number Diff line change
1
+ name : " Scratch Addons"
2
+ author : " apple502j"
3
+ description : " Packs Scratch Addons extension."
4
+ inputs :
5
+ ENVIRONMENT :
6
+ description : ' Environment'
7
+ required : true
8
+ runs :
9
+ using : " composite"
10
+ steps :
11
+ - run : bash $GITHUB_ACTION_PATH/scripts/pack.sh
12
+ shell : bash
13
+ name : " Pack extension"
Original file line number Diff line number Diff line change
1
+ {
2
+ "name" : " packer-script" ,
3
+ "version" : " 1.0.0" ,
4
+ "description" : " Packs Scratch Addons." ,
5
+ "main" : " index.js" ,
6
+ "scripts" : {},
7
+ "repository" : {
8
+ "type" : " git" ,
9
+ "url" : " git+https://github.com/ScratchAddons/packer-script.git"
10
+ },
11
+ "author" : " apple502j" ,
12
+ "license" : " GPL-3.0-or-later" ,
13
+ "bugs" : {
14
+ "url" : " https://github.com/ScratchAddons/packer-script/issues"
15
+ },
16
+ "homepage" : " https://github.com/ScratchAddons/packer-script#readme" ,
17
+ "private" : true ,
18
+ "type" : " module"
19
+ }
Original file line number Diff line number Diff line change
1
+ import fs from "fs/promises" ;
2
+ import path from "path" ;
3
+
4
+ const GITHUB_WORKSPACE = process . env . GITHUB_WORKSPACE ;
5
+ const { default : generate } = await import ( path . join ( GITHUB_WORKSPACE , ".github/gen-manifest.js" ) ) ;
6
+
7
+ const ENVIRONMENT = process . env . ENVIRONMENT ;
8
+
9
+ const MANIFEST_PATH = path . join ( GITHUB_WORKSPACE , "manifest.json" ) ;
10
+
11
+ await fs . copyFile ( MANIFEST_PATH , path . join ( GITHUB_WORKSPACE , ".manifest.json.bak" ) ) ;
12
+
13
+ const manifestFile = await fs . readFile ( MANIFEST_PATH , "utf8" ) ;
14
+ const manifest = generate ( ENVIRONMENT , JSON . parse ( manifestFile ) ) ;
15
+
16
+ await fs . writeFile ( MANIFEST_PATH , JSON . stringify ( manifest ) , "utf8" ) ;
Original file line number Diff line number Diff line change
1
+ #! /bin/bash
2
+ cd $GITHUB_WORKSPACE
3
+
4
+ export ENVIRONMENT=$INPUT_ENVIRONMENT
5
+
6
+ echo $( printf " Packing build for %s" $ENVIRONMENT )
7
+
8
+ node $GITHUB_ACTION_PATH /scripts/manifest.js
9
+ mkdir $GITHUB_WORKSPACE /.dist 2> /dev/null
10
+
11
+ VERSION_NAME=$( cat $GITHUB_WORKSPACE /manifest.json | jq " .version_name" | sed " s/[.-]/_/g;s/prerelease/pre/" )
12
+ FILENAME=$( printf " ScratchAddons-%s-%s.zip" $VERSION_NAME $ENVIRONMENT )
13
+
14
+ git archive --format=zip -o $GITHUB_WORKSPACE /.dist/$FILENAME HEAD
15
+ rm $GITHUB_WORKSPACE /manifest.json
16
+ mv $GITHUB_WORKSPACE /.manifest.json.bak $GITHUB_WORKSPACE /manifest.json
17
+
18
+ echo $( printf " Packed as %s" $FILENAME )
You can’t perform that action at this time.
0 commit comments