File tree Expand file tree Collapse file tree 5 files changed +83
-55
lines changed
Expand file tree Collapse file tree 5 files changed +83
-55
lines changed Original file line number Diff line number Diff line change 1- name : Build Mod
1+ name : " Build Mods "
22
33on :
44 push :
77 pull_request :
88 paths :
99 - " mod/**/*"
10+ workflow_call :
1011
1112jobs :
1213 build :
13- runs-on : ubuntu-latest
14+ runs-on : " ubuntu-latest"
1415 steps :
15- - uses : actions/checkout@v3
16- - name : Set up JDK 17
17- uses : actions/setup-java@v3
16+ - uses : " actions/checkout@v4"
17+
18+ - name : " Setting up JDK 17"
19+ uses : " actions/setup-java@v4"
1820 with :
1921 java-version : " 17"
2022 distribution : " adopt"
21- - run : ./gradlew build
22- working-directory : ./mod
23-
24- - name : Upload Forge Build
25- uses : actions/upload-artifact@v3
26- with :
27- name : Forge
28- path : mod/dist/*-forge.jar
2923
30- - name : Upload Fabric Build
31- uses : actions/upload-artifact@v3
32- with :
33- name : Fabric
34- path : mod/dist/*-fabric.jar
35-
36- - name : Release Tag
37- if : startsWith(github.ref, 'refs/tags/v')
38- uses : softprops/action-gh-release@v1
39- with :
40- prerelease : true
41- fail_on_unmatched_files : true
42- files : |
43- mod/dist/*.jar
44- env :
45- GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
24+ - name : " Building mods"
25+ working-directory : " ./mod"
26+ run : " ./gradlew build"
Original file line number Diff line number Diff line change 1- name : Build+Test Server
1+ name : " Build+Test Server"
22
33on :
44 push :
77 pull_request :
88 paths :
99 - " server/**/*"
10+ workflow_call :
1011
1112jobs :
1213 build :
13- runs-on : ubuntu-latest
14- strategy :
15- matrix :
16- version : ["1.2.15", "latest"]
14+ runs-on : " ubuntu-latest"
1715 steps :
18- - uses : actions/checkout@v3
19- - name : Setup bun.sh
20- uses : oven-sh/setup-bun@v1
16+ - uses : " actions/checkout@v4"
17+
18+ - name : " Setting up Bun"
19+ uses : oven-sh/setup-bun@v2
2120 with :
22- bun-version : ${{ matrix.version }}
23- - run : bun install
24- working-directory : ./server
25- - run : bun test
26- working-directory : ./server
21+ bun-version : latest
22+
23+ - name : " Setting up yarn"
24+ working-directory : " ./server"
25+ run : " yarn"
26+
27+ - name : " Checking types"
28+ working-directory : " ./server"
29+ run : " yarn run check:types"
30+
31+ - name : " Checking style"
32+ working-directory : " ./server"
33+ run : " yarn run check:style"
34+
35+ - name : " Testing server"
36+ working-directory : " ./server"
37+ run : " yarn run test"
Original file line number Diff line number Diff line change 1+ name : " Publishing to release"
2+
3+ on :
4+ release :
5+ types :
6+ - " published"
7+
8+ permissions :
9+ contents : " write"
10+
11+ jobs :
12+ release-mod :
13+ runs-on : " ubuntu-latest"
14+ steps :
15+ - uses : " actions/checkout@v4"
16+
17+ - name : " Setting up JDK 17"
18+ uses : " actions/setup-java@v4"
19+ with :
20+ java-version : " 17"
21+ distribution : " adopt"
22+
23+ - name : " Building mods"
24+ working-directory : " ./mod"
25+ run : " ./gradlew build"
26+
27+ - name : " Publishing mods"
28+ working-directory : " ./mod"
29+ run : |
30+ for file in $(find "dist/" -maxdepth 1 -type f -name "*.jar"); do
31+ echo "Uploading $file"
32+ gh release upload ${{ github.event.release.tag_name }} "$file" --clobber
33+ done
34+ env :
35+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
Original file line number Diff line number Diff line change 11# base is shared between build/test and deploy
2- FROM node:18-alpine AS base
2+ # See options at: https://hub.docker.com/r/oven/bun
3+ FROM oven/bun:latest AS base
34
45WORKDIR /usr/src/app/
56
@@ -8,29 +9,28 @@ COPY ./server/package.json /usr/src/app/package.json
89
910FROM base AS build
1011
11- COPY ./server/yarn.lock /usr/src/app/yarn.lock
12- RUN yarn
12+ COPY ./server/bun.lock /usr/src/app/bun.lock
13+ COPY ./server/bunfig.toml /usr/src/app/bunfig.toml
14+ RUN bun install
1315
1416# copy source as late as possible, to reuse docker cache with node_modules
1517COPY ./server /usr/src/app
16- RUN yarn build
17-
18- FROM build AS test
19- RUN yarn test
2018
2119# final image only includes minimal files
2220FROM base AS deploy
2321
22+ COPY --from=build /usr/src/app/bun.lock /usr/src/app/bun.lock
23+ COPY --from=build /usr/src/app/bunfig.toml /usr/src/app/bunfig.toml
2424COPY --from=build /usr/src/app/node_modules /usr/src/app/node_modules
25- COPY --from=build /usr/src/app/dist /usr/src/app/dist
25+ COPY --from=build /usr/src/app/src /usr/src/app/src
2626
2727ENV NODE_ENV=production
2828ENV HOST=0.0.0.0
2929
3030# Mount your FS or volume or whatnot to this folder
31- RUN mkdir / data
31+ # TODO: Fix env override of config data
3232ENV MAPSYNC_DATA_DIR=/data
3333
34- EXPOSE 12312/tcp
34+ # EXPOSE 12312/tcp
3535
36- CMD [ "yarn " , "start" ]
36+ CMD [ "bun" , "run " , "start" ]
Original file line number Diff line number Diff line change 77 "type" : " module" ,
88 "module" : " src/main.ts" ,
99 "scripts" : {
10- "format" : " bunx prettier -w ." ,
10+ "check:types" : " bunx --bun tsc --noEmit --checkJs" ,
11+ "check:style" : " bunx --bun prettier --check ." ,
12+ "format" : " bunx --bun prettier -w ." ,
1113 "test" : " bun test ./src/*.test.ts" ,
1214 "start" : " bun src/main.ts" ,
1315 "start:dev" : " bun --inspect src/main.ts" ,
14- "check" : " bunx tsc" ,
1516 "compile" : " bun build --compile . --outfile out/mapsync-server"
1617 },
1718 "dependencies" : {
You can’t perform that action at this time.
0 commit comments