Skip to content

Commit 1c3dbcb

Browse files
committed
ci
1 parent 68b478f commit 1c3dbcb

21 files changed

+240
-7209
lines changed

.github/workflows/msbuild.yml

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
# This workflow uses actions that are not certified by GitHub.
2+
# They are provided by a third-party and are governed by
3+
# separate terms of service, privacy policy, and support
4+
# documentation.
5+
6+
name: MSBuild
7+
8+
on:
9+
workflow_dispatch:
10+
push:
11+
branches: [ "main" ]
12+
paths:
13+
- 'themes/**'
14+
- '.github/workflows/msbuild.yml'
15+
16+
permissions:
17+
contents: write
18+
pull-requests: write
19+
20+
jobs:
21+
convert:
22+
runs-on: windows-latest
23+
24+
steps:
25+
- name: Checkout repository
26+
uses: actions/checkout@v4
27+
28+
- name: Setup .NET 6 SDK
29+
uses: actions/setup-dotnet@v5
30+
with:
31+
dotnet-version: '6.0.x'
32+
33+
- name: Clone theme converter
34+
run: git clone https://github.com/microsoft/theme-converter-for-vs.git
35+
36+
- name: Build converter
37+
run: dotnet build .\theme-converter-for-vs\ThemeConverter\ThemeConverter.csproj -c Release
38+
39+
- name: Convert VS Code themes to Visual Studio
40+
shell: pwsh
41+
run: |
42+
$ErrorActionPreference = 'Stop'
43+
$converter = Join-Path $PWD 'theme-converter-for-vs\ThemeConverter\bin\Release\net6.0\ThemeConverter.exe'
44+
if (!(Test-Path $converter)) { throw "Converter not found at $converter" }
45+
$inputDir = Join-Path $env:GITHUB_WORKSPACE 'themes'
46+
if (!(Test-Path $inputDir)) { throw "Input directory not found: $inputDir" }
47+
$outputDir = Join-Path $env:GITHUB_WORKSPACE 'visualstudio'
48+
if (Test-Path $outputDir) { Remove-Item -Recurse -Force $outputDir }
49+
New-Item -ItemType Directory -Force -Path $outputDir | Out-Null
50+
Get-ChildItem -Path $inputDir -Filter *.json -File | ForEach-Object {
51+
& $converter -i $_.FullName -o $outputDir
52+
}
53+
54+
- name: Create Pull Request
55+
uses: peter-evans/create-pull-request@v7
56+
with:
57+
commit-message: "chore(vs): convert VS Code themes to Visual Studio"
58+
title: "Generate Visual Studio themes from VS Code themes"
59+
body: "Automated conversion of VS Code themes under `themes/` using Microsoft's Theme Converter."
60+
branch: "chore/visualstudio-themes"
61+
base: "main"
62+
add-paths: |
63+
visualstudio/**

.github/workflows/release.yml

Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
name: Nightly packages and prerelease
2+
3+
on:
4+
push:
5+
workflow_dispatch:
6+
inputs:
7+
notes:
8+
description: Optional notes for this nightly
9+
type: string
10+
required: false
11+
12+
concurrency:
13+
group: nightly-release-${{ github.ref }}
14+
cancel-in-progress: true
15+
16+
jobs:
17+
package-and-release:
18+
name: Build VSIX, zip folders, publish prerelease
19+
runs-on: ubuntu-latest
20+
permissions:
21+
contents: write
22+
steps:
23+
- name: Checkout
24+
uses: actions/checkout@v4
25+
26+
- name: Setup Node.js
27+
uses: actions/setup-node@v4
28+
with:
29+
node-version: 20
30+
31+
- name: Compute metadata
32+
id: meta
33+
shell: bash
34+
run: |
35+
set -euo pipefail
36+
NAME=$(jq -r .name package.json)
37+
VERSION=$(jq -r .version package.json)
38+
DATE=$(date -u +%Y%m%d)
39+
SHA_SHORT=$(git rev-parse --short HEAD)
40+
SUFFIX="$DATE-$SHA_SHORT"
41+
TAG="nightly-$SUFFIX"
42+
echo "name=$NAME" >> "$GITHUB_OUTPUT"
43+
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
44+
echo "date=$DATE" >> "$GITHUB_OUTPUT"
45+
echo "sha_short=$SHA_SHORT" >> "$GITHUB_OUTPUT"
46+
echo "suffix=$SUFFIX" >> "$GITHUB_OUTPUT"
47+
echo "tag=$TAG" >> "$GITHUB_OUTPUT"
48+
49+
- name: Package VSCode extension (.vsix)
50+
run: |
51+
npx --yes @vscode/vsce package -o "${{ steps.meta.outputs.name }}-${{ steps.meta.outputs.version }}-${{ steps.meta.outputs.sha_short }}.vsix"
52+
53+
- name: Zip theme folders
54+
run: |
55+
if [ -d visualstudio ]; then zip -r "visualstudio-${{ steps.meta.outputs.suffix }}.zip" visualstudio; fi
56+
if [ -d textmate ]; then zip -r "textmate-${{ steps.meta.outputs.suffix }}.zip" textmate; fi
57+
if [ -d intellij ]; then zip -r "intellij-${{ steps.meta.outputs.suffix }}.zip" intellij; fi
58+
if [ -d themes ]; then zip -r "themes-${{ steps.meta.outputs.suffix }}.zip" themes; fi
59+
if [ -d zed ]; then zip -r "zed-${{ steps.meta.outputs.suffix }}.zip" zed; fi
60+
61+
- name: Collect artifact files
62+
id: collect
63+
run: |
64+
set -euo pipefail
65+
files="${{ steps.meta.outputs.name }}-${{ steps.meta.outputs.version }}-${{ steps.meta.outputs.sha_short }}.vsix"
66+
for f in \
67+
"visualstudio-${{ steps.meta.outputs.suffix }}.zip" \
68+
"textmate-${{ steps.meta.outputs.suffix }}.zip" \
69+
"intellij-${{ steps.meta.outputs.suffix }}.zip" \
70+
"themes-${{ steps.meta.outputs.suffix }}.zip" \
71+
"zed-${{ steps.meta.outputs.suffix }}.zip"; do
72+
[ -f "$f" ] && files="$files"$'\n'$f
73+
done
74+
echo 'list<<EOF' >> "$GITHUB_OUTPUT"
75+
echo "$files" >> "$GITHUB_OUTPUT"
76+
echo 'EOF' >> "$GITHUB_OUTPUT"
77+
78+
- name: Upload build artifacts
79+
uses: actions/upload-artifact@v4
80+
with:
81+
name: nightly-artifacts-${{ steps.meta.outputs.suffix }}
82+
retention-days: 7
83+
path: ${{ steps.collect.outputs.list }}
84+
85+
- name: Create GitHub prerelease
86+
uses: softprops/action-gh-release@v2
87+
env:
88+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
89+
with:
90+
tag_name: ${{ steps.meta.outputs.tag }}
91+
name: Nightly ${{ steps.meta.outputs.date }} (${{ steps.meta.outputs.sha_short }})
92+
prerelease: true
93+
generate_release_notes: true
94+
body: |
95+
Nightly artifacts built from ${{ github.sha }} on ${{ github.ref_name }} by @${{ github.actor }}.
96+
97+
Attached files:
98+
${{ steps.collect.outputs.list }}
99+
100+
${{ github.event.inputs.notes }}
101+
files: ${{ steps.collect.outputs.list }}

Makefile

Lines changed: 43 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,10 @@ TM_CONVERTER := json2tm/target/release/json2tm
1919
TM_USER := ~/Library/Application\ Support/TextMate/Themes
2020
SUBLIME_USER := ~/Library/Application\ Support/Sublime\ Text/Packages/User
2121

22-
INTELLIJDIR := intellij
2322
JB_REPO_URL := https://github.com/JetBrains/colorSchemeTool
2423
JB_SRC_DIR := target/colorSchemeTool
24+
INTELLIJDIR := intellij
25+
INTELLIJ_CONVERTER := $(JB_SRC_DIR)/colorSchemeTool.py
2526

2627
DEFAULT_THEMES := \
2728
$(THEMESDIR)/oxocarbon-color-theme.json \
@@ -34,12 +35,9 @@ DEFAULT_THEMES := \
3435
$(THEMESDIR)/oxocarbon-oled-mono-compat-color-theme.json \
3536
$(THEMESDIR)/PRINT.json
3637

37-
TEXTMATE_THEMES := $(patsubst $(THEMESDIR)/%.json,$(TMDIR)/%.tmTheme,$(filter-out $(THEMESDIR)/%compat%.json,$(DEFAULT_THEMES)))
38-
39-
.PHONY: all build clean dotfiles help install mono-coolgray mono-warmgray \
40-
PRINT zed setup-zed dotfiles-zed dotfiles-sublime install-zed install-sublime install-textmate textmate intellij
41-
42-
.SECONDARY:
38+
.PHONY: all build clean dotfiles help install mono-coolgray mono-warmgray PRINT \
39+
zed setup-zed intellij setup-intellij dotfiles-zed dotfiles-sublime \
40+
install-zed install-sublime install-textmate textmate
4341

4442
all: $(DEFAULT_THEMES)
4543

@@ -91,15 +89,18 @@ check-xcode:
9189
exit 1; \
9290
}
9391

94-
check-jq: ## Verify jq is available
92+
check-jq:
9593
@command -v jq >/dev/null 2>&1 || { \
9694
echo "Error: jq required"; \
9795
exit 1; \
9896
}
9997

100-
zed: $(ZED_BUNDLE)
98+
check-python:
99+
@PY=$$(command -v python2.7 >/dev/null 2>&1 && echo python2.7 || (command -v python3 >/dev/null 2>&1 && echo python3 || (command -v python >/dev/null 2>&1 && echo python || echo ""))); \
100+
if [ -z "$$PY" ]; then echo "Error: python3 or python required"; exit 1; fi
101101

102102
setup-zed: check-xcode $(ZED_SRC_DIR)
103+
zed: $(ZED_BUNDLE)
103104

104105
$(ZED_SRC_DIR): | check-xcode
105106
@[ -d "$(ZED_SRC_DIR)/.git" ] || \
@@ -114,7 +115,7 @@ $(ZED_IMPORTER): | setup-zed
114115
$(ZED_BUNDLE): check-jq setup-zed $(ZED_IMPORTER) all | $(THEMESDIR) $(OUTDIR)
115116
@mkdir -p $(dir $(ZED_BUNDLE))
116117
@echo "Converting themes for Zed..."
117-
@for f in $(filter-out $(THEMESDIR)/PRINT.json $(ZED_BUNDLE),$(wildcard $(THEMESDIR)/*.json)); do \
118+
@for f in $(filter-out $(THEMESDIR)/PRINT.json,$(wildcard $(THEMESDIR)/*.json)); do \
118119
$(ZED_IMPORTER) $$f --output $(OUTDIR)/zed-$$(basename $$f); \
119120
done; \
120121
jq -s 'def set_accent_and_players: \
@@ -142,7 +143,7 @@ $(ZED_BUNDLE): check-jq setup-zed $(ZED_IMPORTER) all | $(THEMESDIR) $(OUTDIR)
142143
$(OUTDIR)/zed-*.json > $(ZED_BUNDLE)
143144
@echo "Zed theme bundle created: $(ZED_BUNDLE)"
144145

145-
textmate: $(TEXTMATE_THEMES)
146+
textmate: $(foreach f,$(sort $(DEFAULT_THEMES) $(wildcard $(THEMESDIR)/*.json)),$(if $(findstring compat,$(notdir $(f))),,$(patsubst $(THEMESDIR)/%.json,$(TMDIR)/%.tmTheme,$(f))))
146147

147148
$(TM_CONVERTER):
148149
cargo build --release --manifest-path json2tm/Cargo.toml
@@ -151,36 +152,32 @@ $(TMDIR)/%.tmTheme: $(THEMESDIR)/%.json $(TM_CONVERTER)
151152
@mkdir -p $(dir $@)
152153
$(TM_CONVERTER) $< $@
153154

154-
intellij: textmate
155-
@echo "Converting TextMate themes to IntelliJ..."
155+
setup-intellij: check-python $(JB_SRC_DIR)
156+
intellij: $(patsubst $(THEMESDIR)/%.json,$(INTELLIJDIR)/%.icls,$(wildcard $(THEMESDIR)/*.json))
157+
@echo "IntelliJ schemes written to $(INTELLIJDIR)"
158+
159+
$(JB_SRC_DIR):
160+
@[ -d "$(JB_SRC_DIR)/.git" ] || \
161+
git clone --depth 1 $(JB_REPO_URL) $(JB_SRC_DIR); \
162+
git -C $(JB_SRC_DIR) fetch --depth 1 origin master >/dev/null 2>&1 && \
163+
git -C $(JB_SRC_DIR) reset --hard FETCH_HEAD >/dev/null 2>&1
164+
165+
$(INTELLIJ_CONVERTER): | setup-intellij
166+
@test -f $@ || { echo "Error: converter not found: $@"; exit 1; }
167+
168+
$(INTELLIJDIR)/%.icls: $(THEMESDIR)/%.json | setup-intellij $(INTELLIJ_CONVERTER)
169+
@mkdir -p $(dir $@)
156170
@set -e; \
157171
PY=$$(command -v python2.7 >/dev/null 2>&1 && echo python2.7 || (command -v python3 >/dev/null 2>&1 && echo python3 || (command -v python >/dev/null 2>&1 && echo python || echo ""))); \
158172
if [ -z "$$PY" ]; then echo "Error: python3 or python required"; exit 1; fi; \
159-
@[ -d "$(JB_SRC_DIR)/.git" ] || git clone --depth 1 $(JB_REPO_URL) $(JB_SRC_DIR); \
160-
git -C $(JB_SRC_DIR) fetch --depth 1 origin master >/dev/null 2>&1 || true; \
161-
git -C $(JB_SRC_DIR) reset --hard FETCH_HEAD >/dev/null 2>&1 || true; \
162-
mkdir -p $(INTELLIJDIR); \
163-
for f in $(wildcard $(TMDIR)/*.tmTheme); do \
164-
name=$$(basename $$f .tmTheme); \
165-
( cd $(JB_SRC_DIR) && $$PY colorSchemeTool.py ../..//$$f ../..//$(INTELLIJDIR)/$$name.icls ); \
166-
done; \
167-
echo "IntelliJ schemes written to $(INTELLIJDIR)"
168-
169-
clean:
170-
cargo clean; rm -f $(OUTDIR)/*.json $(THEMESDIR)/*.json $(ZEDDIR)/*.json $(TMDIR)/*.tmTheme $(INTELLIJDIR)/*.icls
173+
( cd $(JB_SRC_DIR) && $$PY colorSchemeTool.py ../..//$< ../..//$@ )
171174

172175
dotfiles:
173176
mkdir -p $(ASSETS)
174177
cursor --list-extensions > $(EXTENSIONS)
175178
cp $(CURSOR_CFG)/settings.json $(ASSETS)/settings.json
176179
cp $(CURSOR_CFG)/keybindings.json $(ASSETS)/keybindings.json
177180

178-
install: dotfiles
179-
xargs -I {} cursor --install-extension {} < $(EXTENSIONS)
180-
mkdir -p $(CURSOR_CFG)
181-
cp $(ASSETS)/settings.json $(CURSOR_CFG)/
182-
cp $(ASSETS)/keybindings.json $(CURSOR_CFG)/
183-
184181
dotfiles-zed:
185182
mkdir -p $(ASSETS)
186183
cp $(ZED_CFG)/settings.json $(ASSETS)/settings-zed.json
@@ -189,16 +186,25 @@ dotfiles-sublime:
189186
mkdir -p $(ASSETS)
190187
cp $(SUBLIME_USER)/Preferences.sublime-settings $(ASSETS)/Preferences.sublime-settings
191188

192-
install-zed:
189+
install: dotfiles
190+
xargs -I {} cursor --install-extension {} < $(EXTENSIONS)
191+
mkdir -p $(CURSOR_CFG)
192+
cp $(ASSETS)/settings.json $(CURSOR_CFG)/
193+
cp $(ASSETS)/keybindings.json $(CURSOR_CFG)/
194+
195+
install-zed: zed
193196
mkdir -p $(ZED_CFG)/themes
194197
if [ -f $(ZED_BUNDLE) ]; then cp -f $(ZED_BUNDLE) $(ZED_CFG)/themes/oxocarbon.json; fi
195-
if [ -f $(ASSETS)/settings-zed.json ]; then mv -f $(ASSETS)/settings-zed.json $(ZED_CFG)/settings.json; fi
198+
if [ -f $(ASSETS)/settings-zed.json ]; then cp -f $(ASSETS)/settings-zed.json $(ZED_CFG)/settings.json; fi
196199

197-
install-sublime:
200+
install-sublime: textmate
198201
mkdir -p $(SUBLIME_USER)
199-
cp $(TMDIR)/*.tmTheme $(SUBLIME_USER)/
202+
cp $(wildcard $(THEMESDIR)/*.json) $(SUBLIME_USER)/
200203
cp $(ASSETS)/Preferences.sublime-settings $(SUBLIME_USER)/Preferences.sublime-settings
201204

202-
install-textmate:
205+
install-textmate: textmate
203206
mkdir -p $(TM_USER)
204-
cp $(TMDIR)/*.tmTheme $(TM_USER)/
207+
cp $(filter-out %compat%.tmTheme,$(wildcard $(TMDIR)/*.tmTheme)) $(TM_USER)/
208+
209+
clean:
210+
cargo clean; rm -f $(OUTDIR)/*.json $(THEMESDIR)/*.json $(ZEDDIR)/*.json $(TMDIR)/*.tmTheme $(INTELLIJDIR)/*.icls

0 commit comments

Comments
 (0)