Use openssl for SHA256 checksums (cross-platform) #20
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: | |
| push: | |
| tags: | |
| - "v*" | |
| concurrency: | |
| group: release-${{ github.ref }} | |
| cancel-in-progress: true | |
| permissions: | |
| contents: write | |
| jobs: | |
| ci: | |
| name: CI (${{ matrix.target }}) | |
| runs-on: ${{ matrix.runner }} | |
| defaults: | |
| run: | |
| shell: bash | |
| strategy: | |
| fail-fast: true | |
| matrix: | |
| include: | |
| - target: x86_64-linux | |
| runner: ubuntu-latest | |
| - target: aarch64-linux | |
| runner: ubuntu-24.04-arm | |
| - target: aarch64-macos | |
| runner: macos-15 | |
| - target: x86_64-windows | |
| runner: windows-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: mlugg/setup-zig@v2 | |
| with: | |
| version: 0.15.2 | |
| - name: Build Zig library | |
| run: zig build -Doptimize=ReleaseFast | |
| - name: Run Zig tests | |
| run: zig build test | |
| - name: Set up Erlang/Elixir | |
| uses: erlef/setup-beam@v1 | |
| with: | |
| otp-version: "27" | |
| elixir-version: "1.17" | |
| - name: Install Elixir deps | |
| run: | | |
| mix local.hex --force | |
| mix local.rebar --force | |
| mix deps.get | |
| - name: Fix Zigler Windows NIF headers | |
| if: runner.os == 'Windows' | |
| run: | | |
| mkdir -p deps/zigler/priv/erl_nif_win | |
| curl -sL "https://raw.githubusercontent.com/E-xyza/zigler/0.15.2/priv/erl_nif_win/erl_nif_win.h" \ | |
| -o deps/zigler/priv/erl_nif_win/erl_nif_win.h | |
| curl -sL "https://raw.githubusercontent.com/E-xyza/zigler/0.15.2/priv/erl_nif_win/erl_nif_api_funcs_win.h" \ | |
| -o deps/zigler/priv/erl_nif_win/erl_nif_api_funcs_win.h | |
| - name: Run Elixir tests | |
| env: | |
| TAILWIND_COMPILER_PATH: "true" | |
| run: mix test | |
| build_nif: | |
| name: Build NIF (${{ matrix.target }}) | |
| needs: ci | |
| runs-on: ${{ matrix.runner }} | |
| defaults: | |
| run: | |
| shell: bash | |
| strategy: | |
| fail-fast: true | |
| matrix: | |
| include: | |
| - target: x86_64-linux | |
| runner: ubuntu-latest | |
| nif_ext: so | |
| - target: aarch64-linux | |
| runner: ubuntu-24.04-arm | |
| nif_ext: so | |
| - target: aarch64-macos | |
| runner: macos-15 | |
| nif_ext: so | |
| - target: x86_64-windows | |
| runner: windows-latest | |
| nif_ext: dll | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: mlugg/setup-zig@v2 | |
| with: | |
| version: 0.15.2 | |
| - name: Set up Erlang/Elixir | |
| uses: erlef/setup-beam@v1 | |
| with: | |
| otp-version: "27" | |
| elixir-version: "1.17" | |
| - name: Install Elixir deps | |
| run: | | |
| mix local.hex --force | |
| mix local.rebar --force | |
| mix deps.get | |
| - name: Fix Zigler Windows NIF headers | |
| if: runner.os == 'Windows' | |
| run: | | |
| mkdir -p deps/zigler/priv/erl_nif_win | |
| curl -sL "https://raw.githubusercontent.com/E-xyza/zigler/0.15.2/priv/erl_nif_win/erl_nif_win.h" \ | |
| -o deps/zigler/priv/erl_nif_win/erl_nif_win.h | |
| curl -sL "https://raw.githubusercontent.com/E-xyza/zigler/0.15.2/priv/erl_nif_win/erl_nif_api_funcs_win.h" \ | |
| -o deps/zigler/priv/erl_nif_win/erl_nif_api_funcs_win.h | |
| - name: Build NIF | |
| env: | |
| TAILWIND_COMPILER_PATH: "true" | |
| run: mix compile | |
| - name: Package NIF | |
| run: | | |
| NIF_FILE=$(find _build -name "Elixir.TailwindCompiler.NIF.${{ matrix.nif_ext }}" -type f | head -1) | |
| if [ -z "$NIF_FILE" ]; then | |
| echo "ERROR: Could not find compiled NIF file" | |
| find _build -name "*NIF*" -type f | |
| exit 1 | |
| fi | |
| echo "Found NIF at: $NIF_FILE" | |
| mkdir -p release | |
| cp "$NIF_FILE" "release/Elixir.TailwindCompiler.NIF.${{ matrix.nif_ext }}" | |
| cd release | |
| tar czf "tailwind_compiler-nif-${{ matrix.target }}.tar.gz" "Elixir.TailwindCompiler.NIF.${{ matrix.nif_ext }}" | |
| openssl dgst -sha256 "tailwind_compiler-nif-${{ matrix.target }}.tar.gz" | sed 's/.*= //' | tee "tailwind_compiler-nif-${{ matrix.target }}.tar.gz.sha256" | |
| - name: Upload artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: nif-${{ matrix.target }} | |
| path: release/tailwind_compiler-nif-* | |
| release: | |
| name: Create Release | |
| needs: build_nif | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Download all artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| path: artifacts | |
| merge-multiple: true | |
| - name: Create GitHub Release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| files: artifacts/* | |
| generate_release_notes: true |