Skip to content

Commit 74cb7b9

Browse files
authored
Merge pull request #7 from Priyans-hu/chore/github-actions
Add GitHub Actions CI and release workflow
2 parents e0ff2fc + d0795f6 commit 74cb7b9

File tree

3 files changed

+114
-8
lines changed

3 files changed

+114
-8
lines changed

.github/workflows/ci.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: CI
2+
3+
on:
4+
pull_request:
5+
branches: [main]
6+
push:
7+
branches: [main]
8+
9+
jobs:
10+
build:
11+
runs-on: macos-15
12+
steps:
13+
- uses: actions/checkout@v4
14+
15+
- name: Build
16+
run: |
17+
cd TokenMeter
18+
swift build -c release
19+
20+
- name: Verify binary
21+
run: |
22+
test -f TokenMeter/.build/release/TokenMeter
23+
file TokenMeter/.build/release/TokenMeter

.github/workflows/release.yml

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags: ['v*']
6+
7+
permissions:
8+
contents: write
9+
10+
jobs:
11+
build-and-release:
12+
runs-on: macos-15
13+
steps:
14+
- uses: actions/checkout@v4
15+
16+
- name: Extract version
17+
id: version
18+
run: echo "version=${GITHUB_REF_NAME}" >> "$GITHUB_OUTPUT"
19+
20+
- name: Build release binary
21+
run: |
22+
cd TokenMeter
23+
swift build -c release
24+
25+
- name: Create app bundle
26+
run: |
27+
APP="TokenMeter.app"
28+
mkdir -p "${APP}/Contents/MacOS"
29+
mkdir -p "${APP}/Contents/Resources"
30+
31+
cp TokenMeter/.build/release/TokenMeter "${APP}/Contents/MacOS/"
32+
33+
# Copy icon if present
34+
if [ -f TokenMeter/TokenMeter/Resources/AppIcon.icns ]; then
35+
cp TokenMeter/TokenMeter/Resources/AppIcon.icns "${APP}/Contents/Resources/"
36+
fi
37+
38+
# Generate Info.plist
39+
VERSION="${{ steps.version.outputs.version }}"
40+
VERSION="${VERSION#v}"
41+
cat > "${APP}/Contents/Info.plist" << PLIST
42+
<?xml version="1.0" encoding="UTF-8"?>
43+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
44+
<plist version="1.0">
45+
<dict>
46+
<key>CFBundleExecutable</key>
47+
<string>TokenMeter</string>
48+
<key>CFBundleIdentifier</key>
49+
<string>com.tokenmeter.app</string>
50+
<key>CFBundleName</key>
51+
<string>TokenMeter</string>
52+
<key>CFBundleDisplayName</key>
53+
<string>TokenMeter</string>
54+
<key>CFBundleShortVersionString</key>
55+
<string>${VERSION}</string>
56+
<key>CFBundleVersion</key>
57+
<string>${VERSION}</string>
58+
<key>CFBundlePackageType</key>
59+
<string>APPL</string>
60+
<key>CFBundleIconFile</key>
61+
<string>AppIcon</string>
62+
<key>LSUIElement</key>
63+
<true/>
64+
<key>LSMinimumSystemVersion</key>
65+
<string>14.0</string>
66+
</dict>
67+
</plist>
68+
PLIST
69+
70+
- name: Ad-hoc code sign
71+
run: |
72+
codesign --force --deep --sign - TokenMeter.app
73+
74+
- name: Verify signature
75+
run: |
76+
codesign -dv --verbose=4 TokenMeter.app
77+
78+
- name: Create zip
79+
run: |
80+
ditto -c -k --keepParent TokenMeter.app TokenMeter-${{ steps.version.outputs.version }}-macos.zip
81+
82+
- name: Create GitHub Release
83+
uses: softprops/action-gh-release@v2
84+
with:
85+
files: TokenMeter-${{ steps.version.outputs.version }}-macos.zip
86+
generate_release_notes: true

README.md

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,17 +30,11 @@ curl -fsSL https://raw.githubusercontent.com/Priyans-hu/tokenmeter/main/install.
3030

3131
Downloads the latest release, extracts to `/Applications`, and removes quarantine.
3232

33-
### Homebrew
34-
35-
```bash
36-
brew install Priyans-hu/tap/tokenmeter
37-
```
38-
3933
### Manual Download
4034

4135
1. Download `TokenMeter-v*.zip` from [Releases](https://github.com/Priyans-hu/tokenmeter/releases/latest)
4236
2. Extract and move `TokenMeter.app` to `/Applications`
43-
3. Right-click → Open on first launch (to bypass Gatekeeper)
37+
3. If you see "damaged" error, run: `xattr -cr /Applications/TokenMeter.app`
4438

4539
### Build from Source
4640

@@ -129,4 +123,7 @@ MIT License. See [LICENSE](LICENSE) for details.
129123

130124
## Contributing
131125

132-
See [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines.
126+
1. Fork and clone the repo
127+
2. Create a feature branch: `git checkout -b feat/my-feature`
128+
3. Build: `cd TokenMeter && swift build -c release`
129+
4. Submit a PR to `main`

0 commit comments

Comments
 (0)