Skip to content

Commit 3db636b

Browse files
Build macos (#4)
* add macos build * update dimensions * clippy * refactor * Update readme.md * remove readme
1 parent f63e030 commit 3db636b

File tree

10 files changed

+82
-50
lines changed

10 files changed

+82
-50
lines changed

.github/workflows/release.yml

Lines changed: 37 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -9,43 +9,43 @@ permissions:
99
contents: write
1010

1111
jobs:
12-
# build-and-release-macos:
13-
# runs-on: macos-latest
14-
15-
# steps:
16-
# - name: Checkout repository
17-
# uses: actions/checkout@v3
18-
19-
# - name: Setup Rust
20-
# uses: actions-rs/toolchain@v1
21-
# with:
22-
# toolchain: stable
23-
# override: true
24-
25-
# - name: Setup Certificate
26-
# env:
27-
# CODE_SIGN_CERTIFICATE: ${{ secrets.CODE_SIGN_CERTIFICATE }}
28-
# CERT_PWD: ${{ secrets.CERT_PWD }}
29-
# run: |
30-
# echo "$CODE_SIGN_CERTIFICATE" | base64 --decode > certificate.p12
31-
# stat -f "%N %z" certificate.p12
32-
# security create-keychain -p "" build.keychain
33-
# security default-keychain -d user -s build.keychain
34-
# security unlock-keychain -p "" build.keychain
35-
# security import certificate.p12 -k build.keychain -P "$CERT_PWD" -T /usr/bin/codesign
36-
# security set-key-partition-list -S apple-tool:,apple:,codesign: -s -k "" build.keychain
37-
38-
# - name: Build bundle
39-
# run: make bundle-mac
40-
41-
# - name: Create GitHub Release
42-
# id: create_release
43-
# uses: softprops/action-gh-release@v1
44-
# with:
45-
# files: |
46-
# dist/Hacker_News_aarch64.dmg.zip
47-
# env:
48-
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
12+
build-and-release-macos:
13+
runs-on: macos-latest
14+
15+
steps:
16+
- name: Checkout repository
17+
uses: actions/checkout@v3
18+
19+
- name: Setup Rust
20+
uses: actions-rs/toolchain@v1
21+
with:
22+
toolchain: stable
23+
override: true
24+
25+
- name: Setup Certificate
26+
env:
27+
CODE_SIGN_CERTIFICATE: ${{ secrets.CODE_SIGN_CERTIFICATE }}
28+
CERT_PWD: ${{ secrets.CERT_PWD }}
29+
run: |
30+
echo "$CODE_SIGN_CERTIFICATE" | base64 --decode > certificate.p12
31+
stat -f "%N %z" certificate.p12
32+
security create-keychain -p "" build.keychain
33+
security default-keychain -d user -s build.keychain
34+
security unlock-keychain -p "" build.keychain
35+
security import certificate.p12 -k build.keychain -P "$CERT_PWD" -T /usr/bin/codesign
36+
security set-key-partition-list -S apple-tool:,apple:,codesign: -s -k "" build.keychain
37+
38+
- name: Build bundle
39+
run: make bundle-mac
40+
41+
- name: Create GitHub Release
42+
id: create_release
43+
uses: softprops/action-gh-release@v1
44+
with:
45+
files: |
46+
dist/MineSweeper.dmg
47+
env:
48+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4949

5050
build-and-release-linux:
5151
runs-on: ubuntu-latest

Makefile

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ bundle-mac: clean-dist build
2121
# Copy application files
2222
cp assets/icon.icns "dist/MineSweeper.app/Contents/Resources"
2323
cp assets/Info.plist "dist/MineSweeper.app/Contents"
24-
cp target/release/hacker-news-iced "dist/MineSweeper.app/Contents/MacOS"
25-
chmod +x "dist/MineSweeper.app/Contents/MacOS/hacker-news-iced"
24+
cp target/release/minesweeper-iced "dist/MineSweeper.app/Contents/MacOS"
25+
chmod +x "dist/MineSweeper.app/Contents/MacOS/minesweeper-iced"
2626

2727
codesign --sign "MyApps" "dist/MineSweeper.app"
2828

@@ -49,7 +49,6 @@ bundle-mac: clean-dist build
4949

5050
# Clean up
5151
rm "dist/temp.dmg"
52-
cd dist && zip -y "Hacker_News_aarch64.dmg.zip" "MineSweeper.dmg"
5352

5453
linux-app-image: clean-dist build
5554
echo "Building linux app image"
@@ -70,8 +69,8 @@ install-local-linux: build
7069
mkdir -p ~/.local/share/applications
7170
mkdir -p ~/.local/share/icons
7271
mkdir -p ~/.local/bin
73-
cp target/release/hacker-news-iced ~/.local/bin
74-
cp assets/hacker-news.desktop ~/.local/share/applications
72+
cp target/release/minesweeper-iced ~/.local/bin
73+
cp assets/minesweeper.desktop ~/.local/share/applications
7574
cp -r assets/icons ~/.local/share/icons
7675

7776
install:

assets/Info.plist

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>CFBundleDevelopmentRegion</key>
6+
<string>en</string>
7+
<key>CFBundleDisplayName</key>
8+
<string>MineSweeper</string>
9+
<key>CFBundleExecutable</key>
10+
<string>minesweeper-iced</string>
11+
<key>CFBundleIconFile</key>
12+
<string>icon.icns</string>
13+
<key>CFBundleIdentifier</key>
14+
<string>droberts-minesweeper</string>
15+
<key>CFBundleInfoDictionaryVersion</key>
16+
<string>6.0</string>
17+
<key>CFBundleName</key>
18+
<string>MineSweeper</string>
19+
<key>CFBundlePackageType</key>
20+
<string>APPL</string>
21+
<key>CFBundleShortVersionString</key>
22+
<string>0.0.1</string>
23+
<key>LSApplicationCategoryType</key>
24+
<string>public.app-category.games</string>
25+
<key>LSMinimumSystemVersion</key>
26+
<string>10.9</string>
27+
<key>CFBundleSupportedPlatforms</key>
28+
<array>
29+
<string>MacOSX</string>
30+
</array>
31+
</dict>
32+
</plist>

assets/icon.icns

64.4 KB
Binary file not shown.

minesweeper-iced/readme.md

Lines changed: 0 additions & 3 deletions
This file was deleted.

minesweeper-iced/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ fn launch() -> iced::Result {
1818
})
1919
.theme(|_state| Theme::Dark)
2020
.window(window::Settings {
21-
size: (1024., 1124.).into(),
21+
size: (900., 900.).into(),
2222
#[cfg(target_os = "linux")]
2323
platform_specific: window::settings::PlatformSpecific {
2424
application_id: "minesweeper".into(),
File renamed without changes.

minesweeper-iced/src/views/cell.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ impl CellView {
7676
}
7777
};
7878

79-
container(content).width(45).height(45).into()
79+
container(content).width(35).height(35).into()
8080
}
8181
}
8282

@@ -95,5 +95,5 @@ fn cell_button<'a, Message>(content: impl Into<Element<'a, Message>>) -> Button<
9595
where
9696
Message: Clone + 'a,
9797
{
98-
button(content).width(45).height(45)
98+
button(content).width(35).height(35)
9999
}

minesweeper/src/model.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ impl<'a> CellExpandIter<'a> {
201201

202202
/// An iterator that returns Positions that were opened from the starting
203203
/// position.
204-
impl<'a> Iterator for CellExpandIter<'a> {
204+
impl Iterator for CellExpandIter<'_> {
205205
type Item = (Pos, Cell);
206206

207207
fn next(&mut self) -> Option<Self::Item> {

readme.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,11 @@ https://user-images.githubusercontent.com/33698065/227748843-4da95c55-5bdf-4042-
1818

1919
An Iced UI for the minesweeper game.
2020

21-
<img width="712" alt="image" src="https://github.com/darrell-roberts/minesweeper/assets/33698065/81581b72-4370-4328-8ba7-9fd25d618621">
21+
![Screenshot from 2024-12-30 11-20-52](https://github.com/user-attachments/assets/6fe28841-c3a8-4062-b4bb-3a23d9bf2f3b)
22+
23+
## Download
24+
[Releases](https://github.com/darrell-roberts/minesweeper/releases)
25+
2226

2327
## Build from source
2428

0 commit comments

Comments
 (0)