Skip to content

Commit c3e9355

Browse files
committed
svgs and build instrux
1 parent 1801e45 commit c3e9355

8 files changed

Lines changed: 187 additions & 0 deletions

File tree

.github/workflows/release.yml

Lines changed: 180 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,180 @@
1+
name: Build and Release
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*'
7+
workflow_dispatch:
8+
inputs:
9+
version:
10+
description: 'Version to release'
11+
required: true
12+
default: 'manual'
13+
14+
env:
15+
CARGO_TERM_COLOR: always
16+
17+
jobs:
18+
build-native:
19+
name: Build Native (${{ matrix.os }})
20+
runs-on: ${{ matrix.os }}
21+
strategy:
22+
matrix:
23+
include:
24+
- os: macos-latest
25+
target: x86_64-apple-darwin
26+
artifact_name: wcanvas-macos-x86_64
27+
- os: macos-latest
28+
target: aarch64-apple-darwin
29+
artifact_name: wcanvas-macos-aarch64
30+
31+
steps:
32+
- uses: actions/checkout@v4
33+
34+
- name: Install Rust
35+
uses: dtolnay/rust-toolchain@stable
36+
with:
37+
targets: ${{ matrix.target }}
38+
39+
- name: Install dependencies (macOS)
40+
if: matrix.os == 'macos-latest'
41+
run: |
42+
# No additional dependencies needed for basic build
43+
44+
- name: Build
45+
run: |
46+
cargo build --release --target ${{ matrix.target }}
47+
48+
- name: Create artifact directory
49+
run: mkdir -p artifacts
50+
51+
- name: Copy binary and assets (macOS)
52+
if: matrix.os == 'macos-latest'
53+
run: |
54+
cp target/${{ matrix.target }}/release/wcanvas artifacts/wcanvas
55+
cp -r data artifacts/
56+
cp index.html artifacts/
57+
chmod +x artifacts/wcanvas
58+
59+
- name: Create archive
60+
run: |
61+
cd artifacts
62+
tar -czf ../${{ matrix.artifact_name }}.tar.gz *
63+
64+
- name: Upload artifact
65+
uses: actions/upload-artifact@v4
66+
with:
67+
name: ${{ matrix.artifact_name }}
68+
path: ${{ matrix.artifact_name }}.tar.gz
69+
70+
build-web:
71+
name: Build WebAssembly
72+
runs-on: ubuntu-latest
73+
74+
steps:
75+
- uses: actions/checkout@v4
76+
77+
- name: Install Rust
78+
uses: dtolnay/rust-toolchain@stable
79+
with:
80+
targets: wasm32-unknown-unknown
81+
82+
- name: Install wasm-pack
83+
run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
84+
85+
- name: Build WebAssembly
86+
run: |
87+
wasm-pack build --target web --out-dir pkg --release
88+
89+
- name: Create web artifact
90+
run: |
91+
mkdir -p web-dist
92+
cp -r pkg web-dist/
93+
cp -r data web-dist/
94+
cp index.html web-dist/
95+
cd web-dist
96+
tar -czf ../wcanvas-web.tar.gz *
97+
98+
- name: Upload web artifact
99+
uses: actions/upload-artifact@v4
100+
with:
101+
name: wcanvas-web
102+
path: wcanvas-web.tar.gz
103+
104+
release:
105+
name: Create Release
106+
needs: [build-native, build-web]
107+
runs-on: ubuntu-latest
108+
if: startsWith(github.ref, 'refs/tags/v') || github.event_name == 'workflow_dispatch'
109+
110+
steps:
111+
- uses: actions/checkout@v4
112+
113+
- name: Download all artifacts
114+
uses: actions/download-artifact@v4
115+
with:
116+
path: ./artifacts
117+
118+
- name: Display structure of downloaded files
119+
run: ls -la artifacts/
120+
121+
- name: Create Release
122+
id: create_release
123+
uses: actions/create-release@v1
124+
env:
125+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
126+
with:
127+
tag_name: ${{ github.ref_name || github.event.inputs.version }}
128+
release_name: WCanvas ${{ github.ref_name || github.event.inputs.version }}
129+
body: |
130+
## Changes
131+
- Built for macOS (x86_64 and ARM64)
132+
- WebAssembly build for web browsers
133+
134+
## Downloads
135+
- **macOS (Intel)**: wcanvas-macos-x86_64.tar.gz
136+
- **macOS (Apple Silicon)**: wcanvas-macos-aarch64.tar.gz
137+
- **Web**: wcanvas-web.tar.gz
138+
139+
## Usage
140+
### Native (macOS)
141+
1. Download the appropriate archive for your system
142+
2. Extract the archive
143+
3. Run `./wcanvas`
144+
145+
### Web
146+
1. Download wcanvas-web.tar.gz
147+
2. Extract to a web server directory
148+
3. Open index.html in a modern web browser
149+
draft: false
150+
prerelease: false
151+
152+
- name: Upload macOS x86_64 Release Asset
153+
uses: actions/upload-release-asset@v1
154+
env:
155+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
156+
with:
157+
upload_url: ${{ steps.create_release.outputs.upload_url }}
158+
asset_path: ./artifacts/wcanvas-macos-x86_64/wcanvas-macos-x86_64.tar.gz
159+
asset_name: wcanvas-macos-x86_64.tar.gz
160+
asset_content_type: application/gzip
161+
162+
- name: Upload macOS ARM64 Release Asset
163+
uses: actions/upload-release-asset@v1
164+
env:
165+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
166+
with:
167+
upload_url: ${{ steps.create_release.outputs.upload_url }}
168+
asset_path: ./artifacts/wcanvas-macos-aarch64/wcanvas-macos-aarch64.tar.gz
169+
asset_name: wcanvas-macos-aarch64.tar.gz
170+
asset_content_type: application/gzip
171+
172+
- name: Upload Web Release Asset
173+
uses: actions/upload-release-asset@v1
174+
env:
175+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
176+
with:
177+
upload_url: ${{ steps.create_release.outputs.upload_url }}
178+
asset_path: ./artifacts/wcanvas-web/wcanvas-web.tar.gz
179+
asset_name: wcanvas-web.tar.gz
180+
asset_content_type: application/gzip

data/icons/arrow.svg

Lines changed: 1 addition & 0 deletions
Loading

data/icons/circle.svg

Lines changed: 1 addition & 0 deletions
Loading

data/icons/eraser.svg

Lines changed: 1 addition & 0 deletions
Loading

data/icons/pen.svg

Lines changed: 1 addition & 0 deletions
Loading

data/icons/rectangle.svg

Lines changed: 1 addition & 0 deletions
Loading

data/icons/select.svg

Lines changed: 1 addition & 0 deletions
Loading

data/icons/text.svg

Lines changed: 1 addition & 0 deletions
Loading

0 commit comments

Comments
 (0)