fastqr 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (53) hide show
  1. checksums.yaml +7 -0
  2. data/BUILD.md +482 -0
  3. data/CHANGELOG.md +51 -0
  4. data/CMakeLists.txt +126 -0
  5. data/CONTRIBUTING.md +63 -0
  6. data/DISTRIBUTION.md +730 -0
  7. data/INSTALL.md +171 -0
  8. data/LICENSE +39 -0
  9. data/PREBUILT.md +171 -0
  10. data/README.md +312 -0
  11. data/VERSION +1 -0
  12. data/bindings/nodejs/binding.gyp +38 -0
  13. data/bindings/nodejs/fastqr_node.cpp +125 -0
  14. data/bindings/nodejs/index.d.ts +80 -0
  15. data/bindings/nodejs/index.js +187 -0
  16. data/bindings/nodejs/lib/platform.js +72 -0
  17. data/bindings/nodejs/package.json +45 -0
  18. data/bindings/nodejs/test/test.js +45 -0
  19. data/bindings/php/fastqr_php.cpp +85 -0
  20. data/bindings/php/src/FastQR.php +316 -0
  21. data/bindings/php/tests/FastQRTest.php +97 -0
  22. data/bindings/ruby/extconf.rb +29 -0
  23. data/bindings/ruby/fastqr_ruby.cpp +122 -0
  24. data/bindings/ruby/lib/fastqr/platform.rb +70 -0
  25. data/bindings/ruby/lib/fastqr/version.rb +6 -0
  26. data/bindings/ruby/lib/fastqr.rb +129 -0
  27. data/bindings/ruby/prebuilt/macos-arm64.tar.gz +1 -0
  28. data/bindings/ruby/prebuilt/macos-x86_64.tar.gz +1 -0
  29. data/build.sh +109 -0
  30. data/cmake/fastqrConfig.cmake.in +6 -0
  31. data/composer.json +36 -0
  32. data/docs/CLI_USAGE.md +478 -0
  33. data/docs/NODEJS_USAGE.md +694 -0
  34. data/docs/PHP_USAGE.md +815 -0
  35. data/docs/README.md +191 -0
  36. data/docs/RUBY_USAGE.md +537 -0
  37. data/examples/CMakeLists.txt +7 -0
  38. data/examples/basic.cpp +58 -0
  39. data/include/fastqr.h +97 -0
  40. data/include/stb_image.h +7988 -0
  41. data/include/stb_image_write.h +1724 -0
  42. data/phpunit.xml +18 -0
  43. data/prebuilt/README.md +131 -0
  44. data/scripts/README.md +248 -0
  45. data/scripts/build-binaries.sh +98 -0
  46. data/scripts/build-local.sh +18 -0
  47. data/scripts/install.sh +87 -0
  48. data/scripts/release.sh +78 -0
  49. data/scripts/update-version.sh +58 -0
  50. data/src/cli.cpp +316 -0
  51. data/src/fastqr.cpp +665 -0
  52. data/test.sh +86 -0
  53. metadata +155 -0
data/phpunit.xml ADDED
@@ -0,0 +1,18 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3
+ xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.5/phpunit.xsd"
4
+ bootstrap="vendor/autoload.php"
5
+ colors="true"
6
+ verbose="true">
7
+ <testsuites>
8
+ <testsuite name="FastQR Test Suite">
9
+ <directory>bindings/php/tests</directory>
10
+ </testsuite>
11
+ </testsuites>
12
+ <coverage>
13
+ <include>
14
+ <directory suffix=".php">bindings/php/src</directory>
15
+ </include>
16
+ </coverage>
17
+ </phpunit>
18
+
@@ -0,0 +1,131 @@
1
+ # Pre-built Binaries
2
+
3
+ This directory contains pre-built binaries for FastQR on different platforms.
4
+
5
+ ## Supported Platforms
6
+
7
+ - **macOS**
8
+ - arm64 (Apple Silicon M1/M2/M3)
9
+ - x86_64 (Intel)
10
+ - **Linux**
11
+ - x86_64 (64-bit Intel/AMD)
12
+ - arm64 (64-bit ARM)
13
+
14
+ ## Directory Structure
15
+
16
+ ```
17
+ prebuilt/
18
+ ├── macos-arm64/
19
+ │ ├── lib/
20
+ │ │ └── libfastqr.dylib
21
+ │ ├── bin/
22
+ │ │ └── fastqr
23
+ │ └── include/
24
+ │ └── fastqr.h
25
+ ├── macos-x86_64/
26
+ │ └── ...
27
+ ├── linux-x86_64/
28
+ │ └── ...
29
+ └── linux-arm64/
30
+ └── ...
31
+ ```
32
+
33
+ ## Building Binaries
34
+
35
+ To build binaries for your platform:
36
+
37
+ ```bash
38
+ ./scripts/build-binaries.sh
39
+ ```
40
+
41
+ This will create a tarball in `prebuilt/fastqr-VERSION-PLATFORM.tar.gz`.
42
+
43
+ ## Using Pre-built Binaries
44
+
45
+ ### For Ruby Gem
46
+
47
+ Pre-built binaries are automatically included in the gem and loaded via FFI.
48
+
49
+ ```bash
50
+ gem install fastqr
51
+ # No need to install qrencode or vips!
52
+ ```
53
+
54
+ ### For Node.js
55
+
56
+ Pre-built binaries are automatically included in the npm package.
57
+
58
+ ```bash
59
+ npm install fastqr
60
+ # No need to install qrencode or vips!
61
+ ```
62
+
63
+ ### For PHP
64
+
65
+ Pre-built binaries are included in the Composer package.
66
+
67
+ ```bash
68
+ composer require fastqr/fastqr
69
+ # No need to install qrencode or vips!
70
+ ```
71
+
72
+ ### Manual Installation
73
+
74
+ Download and install pre-built binaries manually:
75
+
76
+ ```bash
77
+ # Download from GitHub Releases
78
+ wget https://github.com/tranhuucanh/fastqr/releases/download/v1.0.0/fastqr-1.0.0-macos-arm64.tar.gz
79
+
80
+ # Extract
81
+ tar xzf fastqr-1.0.0-macos-arm64.tar.gz
82
+
83
+ # Install
84
+ sudo cp -r macos-arm64/lib/* /usr/local/lib/
85
+ sudo cp -r macos-arm64/bin/* /usr/local/bin/
86
+ sudo cp -r macos-arm64/include/* /usr/local/include/
87
+
88
+ # On Linux, update library cache
89
+ sudo ldconfig
90
+ ```
91
+
92
+ Or use the install script:
93
+
94
+ ```bash
95
+ curl -fsSL https://raw.githubusercontent.com/tranhuucanh/fastqr/main/scripts/install.sh | bash
96
+ ```
97
+
98
+ ## Platform Detection
99
+
100
+ The bindings automatically detect your platform and load the appropriate binary:
101
+
102
+ - **Ruby**: `FastQR::Platform.platform`
103
+ - **Node.js**: `require('./lib/platform').detectPlatform()`
104
+ - **PHP**: Platform detected in `FastQR::init()`
105
+
106
+ ## Notes
107
+
108
+ - Binaries are built with static linking of libqrencode and libvips
109
+ - No external dependencies required at runtime
110
+ - Binaries are built on GitHub Actions for consistency
111
+ - All binaries are tested before release
112
+
113
+ ## Building for All Platforms
114
+
115
+ To build binaries for all platforms, use GitHub Actions:
116
+
117
+ ```bash
118
+ git tag -a v1.0.0 -m "Release 1.0.0"
119
+ git push origin v1.0.0
120
+ ```
121
+
122
+ This will trigger the `build-binaries.yml` workflow which builds for all platforms.
123
+
124
+ ## License
125
+
126
+ The pre-built binaries include statically linked libraries:
127
+ - libqrencode (LGPL 2.1)
128
+ - libvips (LGPL 2.1+)
129
+
130
+ As required by LGPL, users can rebuild with different versions. See BUILD.md for instructions.
131
+
data/scripts/README.md ADDED
@@ -0,0 +1,248 @@
1
+ # FastQR Release Scripts
2
+
3
+ This directory contains scripts for building and releasing FastQR.
4
+
5
+ ## Scripts
6
+
7
+ ### 1. `build-local.sh`
8
+ Build fastqr locally for testing.
9
+
10
+ **Usage:**
11
+ ```bash
12
+ ./scripts/build-local.sh
13
+ ```
14
+
15
+ **What it does:**
16
+ - Cleans build directory
17
+ - Runs CMake configuration
18
+ - Builds fastqr binary
19
+ - Output: `build/fastqr`
20
+
21
+ **Example:**
22
+ ```bash
23
+ ./scripts/build-local.sh
24
+ ./build/fastqr --version
25
+ ./build/fastqr "Hello" test.png
26
+ ```
27
+
28
+ ---
29
+
30
+ ### 2. `update-version.sh`
31
+ Update version number across all project files.
32
+
33
+ **Usage:**
34
+ ```bash
35
+ ./scripts/update-version.sh <version>
36
+ ```
37
+
38
+ **What it updates:**
39
+ - `VERSION` file
40
+ - `CMakeLists.txt`
41
+ - `fastqr.gemspec`
42
+ - `bindings/ruby/lib/fastqr/version.rb`
43
+ - `bindings/nodejs/package.json`
44
+ - `composer.json`
45
+ - All `*.md` files (URLs and version references)
46
+
47
+ **Example:**
48
+ ```bash
49
+ ./scripts/update-version.sh 1.0.1
50
+ ```
51
+
52
+ **Note:** This is automatically called by `release.sh`, you rarely need to run it manually.
53
+
54
+ ---
55
+
56
+ ### 3. `release.sh`
57
+ Release a new version to GitHub.
58
+
59
+ **Usage:**
60
+ ```bash
61
+ ./scripts/release.sh <version> # Normal release
62
+ ./scripts/release.sh <version> --force # Force overwrite existing tag
63
+ ```
64
+
65
+ **What it does:**
66
+ 1. Checks if tag already exists
67
+ 2. Checks for uncommitted changes
68
+ 3. Updates version in all files
69
+ 4. Commits changes
70
+ 5. Creates git tag
71
+ 6. Pushes to GitHub
72
+ 7. Triggers GitHub Actions
73
+
74
+ **Normal Release Example:**
75
+ ```bash
76
+ # Make your changes
77
+ git add .
78
+ git commit -m "feat: add new feature"
79
+
80
+ # Release new version
81
+ ./scripts/release.sh 1.0.1
82
+ ```
83
+
84
+ **Force Release Example:**
85
+ ```bash
86
+ # If you need to re-release the same version:
87
+ # 1. Manually delete tag and release on GitHub
88
+ # 2. Run with --force flag
89
+ ./scripts/release.sh 1.0.1 --force
90
+ ```
91
+
92
+ ---
93
+
94
+ ## Release Workflow
95
+
96
+ ### For New Version
97
+
98
+ ```bash
99
+ # 1. Make your changes and commit
100
+ git add .
101
+ git commit -m "feat: your changes"
102
+
103
+ # 2. Build and test locally
104
+ ./scripts/build-local.sh
105
+ ./build/fastqr --version # Should show old version
106
+ ./build/fastqr "Test" test.png
107
+
108
+ # 3. Release new version
109
+ ./scripts/release.sh 1.0.1
110
+ ```
111
+
112
+ GitHub Actions will automatically:
113
+ - Build binaries for all platforms
114
+ - Create GitHub Release
115
+ - Update Homebrew formula
116
+ - Publish to package registries
117
+
118
+ ### For Overwriting Version
119
+
120
+ ```bash
121
+ # 1. Delete tag and release on GitHub manually
122
+ # Go to: https://github.com/tranhuucanh/fastqr/releases
123
+ # - Delete the release
124
+ # - Delete the tag (Settings → Tags)
125
+
126
+ # 2. Force release locally
127
+ ./scripts/release.sh 1.0.0 --force
128
+ ```
129
+
130
+ ---
131
+
132
+ ## Version Management
133
+
134
+ FastQR uses a single-source-of-truth approach for versioning:
135
+
136
+ - **Source:** `VERSION` file
137
+ - **Updated by:** `update-version.sh`
138
+ - **Used in:** All build scripts and CI/CD
139
+
140
+ ### Version Format
141
+
142
+ Semantic Versioning: `MAJOR.MINOR.PATCH`
143
+
144
+ Examples:
145
+ - `1.0.0` - Initial release
146
+ - `1.0.1` - Bug fixes
147
+ - `1.1.0` - New features (backward compatible)
148
+ - `2.0.0` - Breaking changes
149
+
150
+ ---
151
+
152
+ ## Troubleshooting
153
+
154
+ ### "Tag already exists" error
155
+ ```bash
156
+ ./scripts/release.sh 1.0.1
157
+ # Error: Tag v1.0.1 already exists!
158
+ ```
159
+
160
+ **Solution:**
161
+ 1. If you want a new version, use a different number: `1.0.2`
162
+ 2. If you want to overwrite, delete on GitHub first, then use `--force`:
163
+ ```bash
164
+ ./scripts/release.sh 1.0.1 --force
165
+ ```
166
+
167
+ ### "Uncommitted changes" error
168
+ ```bash
169
+ ./scripts/release.sh 1.0.1
170
+ # Error: You have uncommitted changes!
171
+ ```
172
+
173
+ **Solution:**
174
+ ```bash
175
+ git status # Check what's changed
176
+ git add .
177
+ git commit -m "your message"
178
+ ./scripts/release.sh 1.0.1
179
+ ```
180
+
181
+ ### GitHub Actions not triggering
182
+ - Check: https://github.com/tranhuucanh/fastqr/actions
183
+ - Ensure tag was pushed: `git push origin v1.0.1`
184
+ - Check workflow permissions in repo settings
185
+
186
+ ### Homebrew formula not updating
187
+ - Check Actions log: https://github.com/tranhuucanh/fastqr/actions
188
+ - Ensure `HOMEBREW_TAP_TOKEN` secret is set in repo settings
189
+ - Check formula repo: https://github.com/tranhuucanh/homebrew-fastqr
190
+
191
+ ---
192
+
193
+ ## CI/CD Pipeline
194
+
195
+ ```
196
+ Push tag v1.0.1
197
+
198
+ GitHub Actions triggered
199
+
200
+ ┌─────────────────────────────┐
201
+ │ 1. Build binaries │
202
+ │ - macOS (arm64, x86_64) │
203
+ │ - Linux (x86_64, arm64) │
204
+ └─────────────┬───────────────┘
205
+
206
+ ┌─────────────────────────────┐
207
+ │ 2. Create GitHub Release │
208
+ │ - Upload binaries │
209
+ │ - Generate changelog │
210
+ └─────────────┬───────────────┘
211
+
212
+ ┌─────────────────────────────┐
213
+ │ 3. Update Homebrew formula │
214
+ │ - Download source tarball│
215
+ │ - Calculate SHA256 │
216
+ │ - Update Formula/fastqr.rb│
217
+ │ - Push to homebrew-fastqr│
218
+ └─────────────────────────────┘
219
+ ```
220
+
221
+ ---
222
+
223
+ ## Files Modified by Release
224
+
225
+ When you run `./scripts/release.sh 1.0.1`:
226
+
227
+ ```
228
+ VERSION → 1.0.1
229
+ CMakeLists.txt → project(fastqr VERSION 1.0.1 ...)
230
+ fastqr.gemspec → spec.version = '1.0.1'
231
+ bindings/ruby/lib/fastqr/version.rb → VERSION = '1.0.1'
232
+ bindings/nodejs/package.json → "version": "1.0.1"
233
+ composer.json → "version": "1.0.1"
234
+ README.md → /v1.0.1/fastqr-1.0.1-...
235
+ INSTALL.md → /v1.0.1/fastqr-1.0.1-...
236
+ docs/*.md → /v1.0.1/fastqr-1.0.1-...
237
+ ```
238
+
239
+ All changes are committed with message: `chore: bump version to v1.0.1`
240
+
241
+ ---
242
+
243
+ ## See Also
244
+
245
+ - [BUILD.md](../BUILD.md) - Building from source
246
+ - [CONTRIBUTING.md](../CONTRIBUTING.md) - Contributing guidelines
247
+ - [DISTRIBUTION.md](../DISTRIBUTION.md) - Distribution details
248
+
@@ -0,0 +1,98 @@
1
+ #!/bin/bash
2
+
3
+ # FastQR - Build Pre-compiled Binaries
4
+ # This script builds binaries for multiple platforms
5
+
6
+ set -e
7
+
8
+ echo "🔨 FastQR Binary Builder"
9
+ echo "========================"
10
+ echo ""
11
+
12
+ # Get version from CMakeLists.txt
13
+ VERSION=$(grep "project(fastqr VERSION" CMakeLists.txt | sed 's/.*VERSION \([0-9.]*\).*/\1/')
14
+ echo "Version: $VERSION"
15
+
16
+ # Detect platform
17
+ OS="unknown"
18
+ ARCH=$(uname -m)
19
+ if [[ "$OSTYPE" == "darwin"* ]]; then
20
+ OS="macos"
21
+ elif [[ "$OSTYPE" == "linux-gnu"* ]]; then
22
+ OS="linux"
23
+ fi
24
+
25
+ echo "Platform: $OS-$ARCH"
26
+ echo ""
27
+
28
+ # Output directory
29
+ OUTPUT_DIR="prebuilt/$OS-$ARCH"
30
+ mkdir -p "$OUTPUT_DIR/lib"
31
+ mkdir -p "$OUTPUT_DIR/bin"
32
+
33
+ echo "🔧 Building for $OS-$ARCH..."
34
+
35
+ # Clean and build
36
+ rm -rf build
37
+ mkdir build
38
+ cd build
39
+
40
+ # Configure with static linking
41
+ cmake .. \
42
+ -DCMAKE_BUILD_TYPE=Release \
43
+ -DBUILD_SHARED_LIBS=ON \
44
+ -DCMAKE_INSTALL_PREFIX="$PWD/install" \
45
+ -DFASTQR_BUILD_EXAMPLES=OFF
46
+
47
+ # Build
48
+ if [[ "$OS" == "macos" ]]; then
49
+ make -j$(sysctl -n hw.ncpu)
50
+ else
51
+ make -j$(nproc)
52
+ fi
53
+
54
+ # Install to temporary location
55
+ make install DESTDIR="$PWD/staging"
56
+
57
+ cd ..
58
+
59
+ # Copy binaries
60
+ if [[ "$OS" == "macos" ]]; then
61
+ cp build/staging/usr/local/lib/libfastqr.*.dylib "$OUTPUT_DIR/lib/libfastqr.dylib" 2>/dev/null || \
62
+ cp build/libfastqr.*.dylib "$OUTPUT_DIR/lib/libfastqr.dylib" 2>/dev/null || \
63
+ cp build/libfastqr.dylib "$OUTPUT_DIR/lib/libfastqr.dylib"
64
+
65
+ cp build/staging/usr/local/bin/fastqr "$OUTPUT_DIR/bin/fastqr" 2>/dev/null || \
66
+ cp build/fastqr "$OUTPUT_DIR/bin/fastqr"
67
+ else
68
+ # Copy all .so files to lib directory
69
+ if [ -f build/staging/usr/local/lib/libfastqr.so ]; then
70
+ cp build/staging/usr/local/lib/libfastqr.so* "$OUTPUT_DIR/lib/"
71
+ else
72
+ cp build/libfastqr.so* "$OUTPUT_DIR/lib/"
73
+ fi
74
+
75
+ # Copy binary
76
+ if [ -f build/staging/usr/local/bin/fastqr ]; then
77
+ cp build/staging/usr/local/bin/fastqr "$OUTPUT_DIR/bin/fastqr"
78
+ else
79
+ cp build/fastqr "$OUTPUT_DIR/bin/fastqr"
80
+ fi
81
+ fi
82
+
83
+ # Copy headers
84
+ cp -r include "$OUTPUT_DIR/"
85
+
86
+ # Create tarball
87
+ cd prebuilt
88
+ tar czf "fastqr-$VERSION-$OS-$ARCH.tar.gz" "$OS-$ARCH"
89
+ cd ..
90
+
91
+ echo ""
92
+ echo "✅ Binary built successfully!"
93
+ echo "📦 Output: prebuilt/fastqr-$VERSION-$OS-$ARCH.tar.gz"
94
+ echo ""
95
+ echo "Contents:"
96
+ ls -lh "$OUTPUT_DIR/lib/"
97
+ ls -lh "$OUTPUT_DIR/bin/"
98
+
@@ -0,0 +1,18 @@
1
+ #!/bin/bash
2
+ # Build FastQR locally for testing
3
+
4
+ set -e
5
+
6
+ echo "🔨 Building FastQR locally..."
7
+
8
+ # Clean previous build
9
+ rm -rf build/
10
+ mkdir -p build
11
+
12
+ # Build
13
+ cd build
14
+ cmake -DCMAKE_BUILD_TYPE=Release ..
15
+ make -j$(nproc 2>/dev/null || sysctl -n hw.ncpu 2>/dev/null || echo 4)
16
+
17
+ echo "✅ Build complete! Binary: build/fastqr"
18
+ echo "Test it: ./build/fastqr 'Hello World' test.png"
@@ -0,0 +1,87 @@
1
+ #!/bin/bash
2
+
3
+ # FastQR - Install pre-built binaries script
4
+ # This script downloads and installs pre-built binaries for your platform
5
+
6
+ set -e
7
+
8
+ echo "📦 FastQR Binary Installer"
9
+ echo "=========================="
10
+ echo ""
11
+
12
+ # Detect platform
13
+ OS="unknown"
14
+ ARCH=$(uname -m)
15
+ if [[ "$OSTYPE" == "darwin"* ]]; then
16
+ OS="macos"
17
+ elif [[ "$OSTYPE" == "linux-gnu"* ]]; then
18
+ OS="linux"
19
+ else
20
+ echo "❌ Unsupported OS: $OSTYPE"
21
+ exit 1
22
+ fi
23
+
24
+ # Normalize arch
25
+ case "$ARCH" in
26
+ x86_64|amd64)
27
+ ARCH="x86_64"
28
+ ;;
29
+ aarch64|arm64)
30
+ ARCH="arm64"
31
+ ;;
32
+ esac
33
+
34
+ PLATFORM="$OS-$ARCH"
35
+ echo "Platform: $PLATFORM"
36
+
37
+ # Get version
38
+ VERSION="${1:-1.0.0}"
39
+ echo "Version: $VERSION"
40
+ echo ""
41
+
42
+ # Download URL
43
+ TARBALL="fastqr-$VERSION-$PLATFORM.tar.gz"
44
+ URL="https://github.com/tranhuucanh/fastqr/releases/download/v$VERSION/$TARBALL"
45
+
46
+ echo "📥 Downloading $TARBALL..."
47
+ if command -v curl &> /dev/null; then
48
+ curl -L -o "/tmp/$TARBALL" "$URL"
49
+ elif command -v wget &> /dev/null; then
50
+ wget -O "/tmp/$TARBALL" "$URL"
51
+ else
52
+ echo "❌ Neither curl nor wget found. Please install one of them."
53
+ exit 1
54
+ fi
55
+
56
+ echo "📦 Extracting..."
57
+ cd /tmp
58
+ tar xzf "$TARBALL"
59
+
60
+ echo "🔧 Installing..."
61
+ INSTALL_DIR="${INSTALL_DIR:-/usr/local}"
62
+
63
+ if [[ -w "$INSTALL_DIR" ]]; then
64
+ cp -r "$PLATFORM/lib/"* "$INSTALL_DIR/lib/"
65
+ cp -r "$PLATFORM/bin/"* "$INSTALL_DIR/bin/"
66
+ cp -r "$PLATFORM/include/"* "$INSTALL_DIR/include/"
67
+ else
68
+ sudo cp -r "$PLATFORM/lib/"* "$INSTALL_DIR/lib/"
69
+ sudo cp -r "$PLATFORM/bin/"* "$INSTALL_DIR/bin/"
70
+ sudo cp -r "$PLATFORM/include/"* "$INSTALL_DIR/include/"
71
+ fi
72
+
73
+ # Update library cache on Linux
74
+ if [[ "$OS" == "linux" ]]; then
75
+ sudo ldconfig
76
+ fi
77
+
78
+ # Cleanup
79
+ rm -rf "/tmp/$TARBALL" "/tmp/$PLATFORM"
80
+
81
+ echo ""
82
+ echo "✅ FastQR installed successfully!"
83
+ echo ""
84
+ echo "Test it:"
85
+ echo " fastqr --version"
86
+ echo " fastqr \"Hello World\" test.png"
87
+
@@ -0,0 +1,78 @@
1
+ #!/bin/bash
2
+ # Create and push a new release
3
+
4
+ set -e
5
+
6
+ if [ -z "$1" ]; then
7
+ echo "Usage: $0 <version> [--force]"
8
+ echo "Example: $0 1.0.1"
9
+ echo ""
10
+ echo "Options:"
11
+ echo " --force Force re-tag if tag already exists (use with caution!)"
12
+ exit 1
13
+ fi
14
+
15
+ VERSION="$1"
16
+ FORCE_FLAG=""
17
+
18
+ if [ "$2" = "--force" ]; then
19
+ FORCE_FLAG="--force"
20
+ echo "⚠️ Force mode enabled - will overwrite existing tag if present"
21
+ fi
22
+
23
+ echo "🚀 Releasing FastQR v$VERSION..."
24
+ echo ""
25
+
26
+ # Check if we're on a clean working tree
27
+ if [ -n "$(git status --porcelain)" ]; then
28
+ echo "❌ Working directory not clean. Please commit or stash changes first."
29
+ git status --short
30
+ exit 1
31
+ fi
32
+
33
+ # Update version in all files
34
+ echo "📝 Updating version strings..."
35
+ ./scripts/update-version.sh "$VERSION"
36
+
37
+ # Show what changed
38
+ echo ""
39
+ echo "📋 Changed files:"
40
+ git diff --name-only
41
+ echo ""
42
+
43
+ # Commit version changes
44
+ echo "💾 Committing version update..."
45
+ git add -A
46
+ git commit -m "chore: bump version to $VERSION" || echo "Nothing to commit"
47
+
48
+ # Create tag
49
+ echo "🏷️ Creating tag v$VERSION..."
50
+ if git rev-parse "v$VERSION" >/dev/null 2>&1; then
51
+ if [ -z "$FORCE_FLAG" ]; then
52
+ echo "❌ Tag v$VERSION already exists!"
53
+ echo " Use --force to overwrite (not recommended for published versions)"
54
+ exit 1
55
+ else
56
+ echo "⚠️ Deleting existing tag v$VERSION..."
57
+ git tag -d "v$VERSION"
58
+ fi
59
+ fi
60
+
61
+ git tag -a "v$VERSION" -m "Release v$VERSION"
62
+
63
+ # Push
64
+ echo "📤 Pushing to GitHub..."
65
+ # Detect current branch
66
+ CURRENT_BRANCH=$(git rev-parse --abbrev-ref HEAD)
67
+ git push origin "$CURRENT_BRANCH" $FORCE_FLAG
68
+ git push origin "v$VERSION" $FORCE_FLAG
69
+
70
+ echo ""
71
+ echo "✅ Release v$VERSION created successfully!"
72
+ echo ""
73
+ echo "📊 Next steps:"
74
+ echo "1. Monitor GitHub Actions: https://github.com/tranhuucanh/fastqr/actions"
75
+ echo "2. Check npm: https://www.npmjs.com/package/fastqr"
76
+ echo "3. Check RubyGems: https://rubygems.org/gems/fastqr"
77
+ echo "4. Check Packagist: https://packagist.org/packages/fastqr/fastqr"
78
+ echo "5. Check Homebrew: brew upgrade fastqr"