Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
db6b08a
Add a deployment workflow
CelDaemon Apr 3, 2026
addb8cc
Also rerun when self changed
CelDaemon Apr 3, 2026
6a5172e
Fix up the matrix
CelDaemon Apr 3, 2026
aa57969
Make deploy jobs depend on build
CelDaemon Apr 3, 2026
0dedd2a
Rename typo 'depends' -> 'depend'
CelDaemon Apr 3, 2026
1d90446
Rename 'depend' -> 'needs'
CelDaemon Apr 3, 2026
b402333
Run buildLib before bundling cli
CelDaemon Apr 3, 2026
7b10fcc
Use `deno run` subcommand to run CLI
CelDaemon Apr 3, 2026
47c0845
Use correct CLI path
CelDaemon Apr 3, 2026
d0ab854
Use correct -m flag to specify modid
CelDaemon Apr 3, 2026
927de2d
Clean directory before regenerating
CelDaemon Apr 3, 2026
43ccc17
Also delete entries starting with a dot
CelDaemon Apr 3, 2026
9164bd8
Generate in a separate directory
CelDaemon Apr 3, 2026
eb9dceb
Set splitSources and mojangMappings
CelDaemon Apr 3, 2026
6ab7106
Set repo as working dir for Git steps
CelDaemon Apr 3, 2026
8d733d1
Include entries starting with a dot in template
CelDaemon Apr 3, 2026
cbb6c3b
Prevent enabling unsupported options
CelDaemon Apr 3, 2026
7d9ef87
Ensure deploy gets triggered on CLI changes
CelDaemon Apr 3, 2026
9db72d2
Don't crash when nothing has changed
CelDaemon Apr 3, 2026
98e8900
Add 1.14-1.16
CelDaemon Apr 3, 2026
aebeb5e
Allow CI to create new version branches
CelDaemon Apr 3, 2026
8874ef1
Fix new branches to be created from master
CelDaemon Apr 3, 2026
dfa78d2
Don't wait for timeout to create new branches
CelDaemon Apr 6, 2026
14e7ec6
Query remote branches instead
CelDaemon Apr 6, 2026
510eb75
Fetch before switching branch
CelDaemon Apr 6, 2026
21cec16
Don't manually clean working tree
CelDaemon Apr 6, 2026
979537e
Don't use working directory to check for changes
CelDaemon Apr 6, 2026
0c68309
Remove redundant file copy
CelDaemon Apr 6, 2026
e48530d
Fix template deploy not triggering
CelDaemon Apr 6, 2026
b0e1c08
Attempt looking up minecraft versions during deploy
CelDaemon Apr 6, 2026
034666a
Filter for latest of every supported major version
CelDaemon Apr 6, 2026
066d688
Add dynamic matrix input
CelDaemon Apr 6, 2026
8b1325e
Remove unnecessary compat check
CelDaemon Apr 6, 2026
ba7e800
Use reduce over mutating state
CelDaemon Apr 7, 2026
244550e
Use standalone typescript file for scripts
CelDaemon Apr 7, 2026
812bb86
Give template version lookup access to net
CelDaemon Apr 7, 2026
464b749
Prevent output deprecation warning
CelDaemon Apr 7, 2026
ee3ee4a
Remove extra dependencies
CelDaemon Apr 7, 2026
0eadecd
Name CI jobs and steps
CelDaemon Apr 7, 2026
ad2cba0
Ensure correct handling of concurrency
CelDaemon Apr 7, 2026
a680c61
Only deploy run on pushes to main
CelDaemon Apr 7, 2026
6b87570
Reference repository relative to org
CelDaemon Apr 7, 2026
8a2d7b9
Add README.md to deployed template
CelDaemon Apr 8, 2026
1cdd0f1
Allow running the deployment workflow manually
CelDaemon Apr 8, 2026
70b7e93
Add target version in step names
CelDaemon Apr 8, 2026
8fe03cc
Revert "Add README.md to deployed template"
CelDaemon Apr 8, 2026
08f7c5c
Use FabricMCBot as bot user
CelDaemon Apr 8, 2026
a49e2d4
Run deployment weekly instead of on every push
CelDaemon Apr 8, 2026
aa64852
Filter out unsupported versions
CelDaemon Apr 8, 2026
16485d5
Generate branches for all stable versions
CelDaemon Apr 8, 2026
16fba4d
Use version for branch name directly
CelDaemon Apr 8, 2026
0889069
Rename deploy key secret
CelDaemon Apr 8, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .github/scripts/template-versions.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
// @deno-types="../../scripts/dist/fabric-template-generator.d.ts"
import { getTemplateGameVersions } from '../../scripts/dist/fabric-template-generator.js';

console.log(JSON.stringify((await getTemplateGameVersions()).filter(x => x.stable).map(x => x.version)));
94 changes: 94 additions & 0 deletions .github/workflows/deploy-template.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
name: Deploy to Fabric Example Mod
on:
workflow_dispatch:
schedule:
- cron: 37 7 * * SAT

jobs:
build:
name: Build Fabric CLI
runs-on: ubuntu-24.04
outputs:
versions: ${{ steps.versions-lookup.outputs.result }}
steps:
- name: Checkout Repository
uses: actions/checkout@v6
- name: Setup NodeJS
uses: actions/setup-node@v6
with:
node-version: 18
- name: Setup Deno
uses: denoland/setup-deno@v2
with:
deno-version: "2.1.10"
- name: Install NPM dependencies
run: npm i
working-directory: scripts
- name: Build template library
run: npm run buildLib
working-directory: scripts
- name: Build Fabric CLI
run: make build
working-directory: cli
- name: Upload Fabric CLI
uses: actions/upload-artifact@v7
with:
name: cli
path: cli/bundled.ts
- name: Look up template versions
run: echo "result=$(deno run --allow-net .github/scripts/template-versions.ts)" >> "$GITHUB_OUTPUT"
id: versions-lookup
deploy:
name: Deploy ${{ matrix.version }} template
runs-on: ubuntu-24.04
needs: build
concurrency:
group: deploy-${{ matrix.version }}
strategy:
matrix:
version: ${{ fromJSON(needs.build.outputs.versions) }}
steps:
- name: Setup Deno
uses: denoland/setup-deno@v2
with:
deno-version: "2.1.10"
- name: Download Fabric CLI
uses: actions/download-artifact@v8
with:
name: cli
- name: Checkout template repository
uses: actions/checkout@v6
id: existing-checkout
with:
repository: ${{ github.repository_owner }}/fabric-example-mod
path: repo
ssh-key: ${{ secrets.EXAMPLE_MOD_DEPLOY_KEY }}
- name: Switch to ${{ matrix.version }} branch
run: |
if git ls-remote --exit-code --quiet origin '${{ matrix.version }}'
then
git fetch origin '${{ matrix.version }}'
git switch '${{ matrix.version }}'
else
git switch --orphan '${{ matrix.version }}'
fi
working-directory: repo
- name: Create template directory
run: mkdir gen
- name: Generate ${{ matrix.version }} template
run: deno run -A ../bundled.ts init -n 'Example Mod' -m modid -p 'com.example' -v '${{ matrix.version }}' -o splitSources -o mojangMappings
working-directory: gen
- name: Set commit user
run: |
git config user.name 'Fabric Bot'
git config user.email 159731069+FabricMCBot@users.noreply.github.com
working-directory: repo
- name: Commit changes
run: |
git --work-tree ../gen add .
git diff-index --quiet --cached HEAD || git commit -m 'Deployment from commit ${{ github.repository }}@${{ github.sha }}'
working-directory: repo
- name: Push to ${{ matrix.version }}
run: git push -u origin '${{ matrix.version }}'
working-directory: repo

4 changes: 3 additions & 1 deletion scripts/src/lib/template/template.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { addGradleWrapper } from './gradlewrapper';
import { getApiVersionForMinecraft, getKotlinAdapterVersions, getLoaderVersions, getMinecraftYarnVersions, type GameVersion, getGameVersions } from '../Api';
import { addModJson } from './modjson';
import { addGitFiles } from './git';
import { minecraftIsUnobfuscated } from './minecraft';
import { minecraftIsUnobfuscated, minecraftSupportsSplitSources, minecraftSupportsDataGen } from './minecraft';

export const ICON_FONT = "Comic Relief";

Expand Down Expand Up @@ -111,6 +111,8 @@ async function computeConfig(options: Configuration): Promise<ComputedConfigurat
const unobfuscated = minecraftIsUnobfuscated(options.minecraftVersion);
return {
...options,
splitSources: minecraftSupportsSplitSources(options.minecraftVersion) && options.splitSources,
dataGeneration: minecraftSupportsDataGen(options.minecraftVersion) && options.dataGeneration,
loaderVersion: (await getLoaderVersions()).find((v) => v.stable)!.version,
fabricVersion: await getApiVersionForMinecraft(options.minecraftVersion),
yarnVersion: unobfuscated ? undefined : (await getMinecraftYarnVersions(options.minecraftVersion))[0].version,
Expand Down
Loading