|
| 1 | +name: Release |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + tags: |
| 6 | + - 'v*' |
| 7 | + workflow_dispatch: |
| 8 | + inputs: |
| 9 | + version: |
| 10 | + description: 'Version to release (e.g., 1.0.0)' |
| 11 | + required: true |
| 12 | + |
| 13 | +env: |
| 14 | + CARGO_TERM_COLOR: always |
| 15 | + |
| 16 | +jobs: |
| 17 | + build: |
| 18 | + name: Build ${{ matrix.target }} |
| 19 | + runs-on: ${{ matrix.os }} |
| 20 | + strategy: |
| 21 | + fail-fast: false |
| 22 | + matrix: |
| 23 | + include: |
| 24 | + # Linux x86_64 |
| 25 | + - target: x86_64-unknown-linux-gnu |
| 26 | + os: ubuntu-latest |
| 27 | + artifact: bunsenite |
| 28 | + archive: tar.gz |
| 29 | + # Linux aarch64 |
| 30 | + - target: aarch64-unknown-linux-gnu |
| 31 | + os: ubuntu-latest |
| 32 | + artifact: bunsenite |
| 33 | + archive: tar.gz |
| 34 | + cross: true |
| 35 | + # macOS x86_64 |
| 36 | + - target: x86_64-apple-darwin |
| 37 | + os: macos-latest |
| 38 | + artifact: bunsenite |
| 39 | + archive: tar.gz |
| 40 | + # macOS aarch64 (Apple Silicon) |
| 41 | + - target: aarch64-apple-darwin |
| 42 | + os: macos-latest |
| 43 | + artifact: bunsenite |
| 44 | + archive: tar.gz |
| 45 | + # Windows x86_64 |
| 46 | + - target: x86_64-pc-windows-msvc |
| 47 | + os: windows-latest |
| 48 | + artifact: bunsenite.exe |
| 49 | + archive: zip |
| 50 | + |
| 51 | + steps: |
| 52 | + - uses: actions/checkout@v4 |
| 53 | + |
| 54 | + - name: Install Rust |
| 55 | + uses: dtolnay/rust-action@stable |
| 56 | + with: |
| 57 | + targets: ${{ matrix.target }} |
| 58 | + |
| 59 | + - name: Install cross (for cross-compilation) |
| 60 | + if: matrix.cross |
| 61 | + run: cargo install cross --git https://github.com/cross-rs/cross |
| 62 | + |
| 63 | + - name: Install Zig |
| 64 | + uses: goto-bus-stop/setup-zig@v2 |
| 65 | + with: |
| 66 | + version: 0.11.0 |
| 67 | + |
| 68 | + - name: Build Rust (native) |
| 69 | + if: ${{ !matrix.cross }} |
| 70 | + run: cargo build --release --features full --target ${{ matrix.target }} |
| 71 | + |
| 72 | + - name: Build Rust (cross) |
| 73 | + if: matrix.cross |
| 74 | + run: cross build --release --features full --target ${{ matrix.target }} |
| 75 | + |
| 76 | + - name: Build Zig FFI (Unix) |
| 77 | + if: runner.os != 'Windows' |
| 78 | + run: cd zig && zig build -Doptimize=ReleaseFast |
| 79 | + |
| 80 | + - name: Build Zig FFI (Windows) |
| 81 | + if: runner.os == 'Windows' |
| 82 | + run: cd zig && zig build -Doptimize=ReleaseFast |
| 83 | + |
| 84 | + - name: Prepare archive (Unix) |
| 85 | + if: runner.os != 'Windows' |
| 86 | + run: | |
| 87 | + mkdir -p dist |
| 88 | + cp target/${{ matrix.target }}/release/${{ matrix.artifact }} dist/ |
| 89 | + cp zig/zig-out/lib/libbunsenite.* dist/ || true |
| 90 | + cp README.md LICENSE-MIT dist/ |
| 91 | + cd dist && tar -czvf ../bunsenite-${{ github.ref_name }}-${{ matrix.target }}.${{ matrix.archive }} * |
| 92 | +
|
| 93 | + - name: Prepare archive (Windows) |
| 94 | + if: runner.os == 'Windows' |
| 95 | + shell: pwsh |
| 96 | + run: | |
| 97 | + New-Item -ItemType Directory -Force -Path dist |
| 98 | + Copy-Item target/${{ matrix.target }}/release/${{ matrix.artifact }} dist/ |
| 99 | + Copy-Item zig/zig-out/lib/bunsenite.* dist/ -ErrorAction SilentlyContinue |
| 100 | + Copy-Item README.md,LICENSE-MIT dist/ |
| 101 | + Compress-Archive -Path dist/* -DestinationPath bunsenite-${{ github.ref_name }}-${{ matrix.target }}.${{ matrix.archive }} |
| 102 | +
|
| 103 | + - name: Upload artifact |
| 104 | + uses: actions/upload-artifact@v4 |
| 105 | + with: |
| 106 | + name: bunsenite-${{ matrix.target }} |
| 107 | + path: bunsenite-*.${{ matrix.archive }} |
| 108 | + |
| 109 | + release: |
| 110 | + name: Create Release |
| 111 | + needs: build |
| 112 | + runs-on: ubuntu-latest |
| 113 | + permissions: |
| 114 | + contents: write |
| 115 | + |
| 116 | + steps: |
| 117 | + - uses: actions/checkout@v4 |
| 118 | + |
| 119 | + - name: Download all artifacts |
| 120 | + uses: actions/download-artifact@v4 |
| 121 | + with: |
| 122 | + path: artifacts |
| 123 | + |
| 124 | + - name: List artifacts |
| 125 | + run: find artifacts -type f |
| 126 | + |
| 127 | + - name: Create checksums |
| 128 | + run: | |
| 129 | + cd artifacts |
| 130 | + find . -name "bunsenite-*" -type f -exec sha256sum {} \; > ../SHA256SUMS.txt |
| 131 | + cat ../SHA256SUMS.txt |
| 132 | +
|
| 133 | + - name: Create GitHub Release |
| 134 | + uses: softprops/action-gh-release@v1 |
| 135 | + with: |
| 136 | + files: | |
| 137 | + artifacts/**/* |
| 138 | + SHA256SUMS.txt |
| 139 | + draft: false |
| 140 | + prerelease: false |
| 141 | + generate_release_notes: true |
| 142 | + body: | |
| 143 | + ## Bunsenite ${{ github.ref_name }} |
| 144 | +
|
| 145 | + Nickel configuration file parser with multi-language FFI bindings. |
| 146 | +
|
| 147 | + ### Installation |
| 148 | +
|
| 149 | + **Cargo (Rust):** |
| 150 | + ```bash |
| 151 | + cargo install bunsenite |
| 152 | + ``` |
| 153 | +
|
| 154 | + **Homebrew (macOS):** |
| 155 | + ```bash |
| 156 | + brew install bunsenite |
| 157 | + ``` |
| 158 | +
|
| 159 | + **Download binaries:** |
| 160 | + See assets below for pre-built binaries. |
| 161 | +
|
| 162 | + ### Features |
| 163 | + - Parse and evaluate Nickel configuration files |
| 164 | + - Watch mode for live reloading |
| 165 | + - Interactive REPL |
| 166 | + - JSON Schema validation |
| 167 | + - FFI bindings for Deno, ReScript, Node.js |
| 168 | +
|
| 169 | + RSR Compliance: Bronze Tier | TPCF Perimeter: 3 |
| 170 | +
|
| 171 | + publish-crates: |
| 172 | + name: Publish to crates.io |
| 173 | + needs: release |
| 174 | + runs-on: ubuntu-latest |
| 175 | + steps: |
| 176 | + - uses: actions/checkout@v4 |
| 177 | + |
| 178 | + - name: Install Rust |
| 179 | + uses: dtolnay/rust-action@stable |
| 180 | + |
| 181 | + - name: Publish to crates.io |
| 182 | + env: |
| 183 | + CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }} |
| 184 | + run: cargo publish --no-verify |
| 185 | + |
| 186 | + publish-npm: |
| 187 | + name: Publish to npm |
| 188 | + needs: release |
| 189 | + runs-on: ubuntu-latest |
| 190 | + steps: |
| 191 | + - uses: actions/checkout@v4 |
| 192 | + |
| 193 | + - name: Setup Node.js |
| 194 | + uses: actions/setup-node@v4 |
| 195 | + with: |
| 196 | + node-version: '20' |
| 197 | + registry-url: 'https://registry.npmjs.org' |
| 198 | + |
| 199 | + - name: Publish to npm |
| 200 | + working-directory: bindings/rescript |
| 201 | + env: |
| 202 | + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |
| 203 | + run: npm publish --access public |
0 commit comments