add build #30
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Release | |
| on: | |
| workflow_dispatch: | |
| push: | |
| tags: | |
| - "v*.*.*" | |
| jobs: | |
| build: | |
| name: Build on ${{ matrix.os }} | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| matrix: | |
| os: [ubuntu-latest, macos-latest] | |
| continue-on-error: true | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Cache Haskell dependencies (Cabal packages) | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ~/.ghc | |
| ~/.cabal | |
| key: ${{ runner.os }}-ghc-cabal-${{ hashFiles('**/*.cabal', '**/cabal.config') }} | |
| restore-keys: | | |
| ${{ runner.os }}-ghc-cabal- | |
| - name: Install Homebrew on macOS | |
| if: runner.os == 'macOS' | |
| uses: Homebrew/actions/setup-homebrew@master | |
| - name: Install LLVM on macOS | |
| if: runner.os == 'macOS' | |
| run: brew install llvm | |
| env: | |
| PATH: /usr/local/opt/llvm/bin:$PATH | |
| - name: Cache Homebrew | |
| if: runner.os == 'macOS' | |
| uses: actions/cache@v4 | |
| with: | |
| path: /usr/local/Homebrew | |
| key: ${{ runner.os }}-homebrew-${{ hashFiles('**/*.cabal', '**/cabal.config') }} | |
| restore-keys: | | |
| ${{ runner.os }}-homebrew- | |
| - name: Set up Haskell (GHC & Cabal) | |
| uses: haskell-actions/setup@v2 | |
| with: | |
| ghc-version: "9.4.8" | |
| cabal-version: "3.12.1.0" | |
| - name: Install dependencies | |
| run: cabal update | |
| - name: Build executable on Linux or macOS | |
| run: | | |
| cabal build | |
| mkdir -p dist | |
| BIN_PATH=$(cabal list-bin json-to-sql-exe) | |
| if [[ -f "$BIN_PATH" ]]; then | |
| cp "$BIN_PATH" dist/json-to-sql-${{ runner.os == 'Linux' && 'linux' || 'macos' }} | |
| else | |
| echo "Error: Executable not found!" | |
| exit 1 | |
| fi | |
| - name: Upload built executables | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: json-to-sql-${{ runner.os }} | |
| path: dist/json-to-sql-${{ runner.os == 'Linux' && 'linux' || 'macos' }} | |
| release: | |
| name: Create GitHub Release | |
| needs: build | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Download all built binaries | |
| uses: actions/download-artifact@v4 | |
| with: | |
| merge-multiple: true | |
| path: dist | |
| - name: List directory contents | |
| run: ls -l dist | |
| - name: Zip executables | |
| run: | | |
| zip -j dist/json-to-sql-Linux.zip dist/json-to-sql-linux | |
| zip -j dist/json-to-sql-macOS.zip dist/json-to-sql-macos | |
| - name: Create GitHub Release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| files: | | |
| json-to-sql-Linux | |
| json-to-sql-macOS | |
| tag_name: ${{ github.ref }} | |
| name: Release ${{ github.ref }} | |
| body: | | |
| ## JSON-to-SQL CLI Release | |
| - **Linux**: `json-to-sql-Linux.zip` | |
| - **macOS**: `json-to-sql-macOS.zip` | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |