fix: version extraction regex and add manual trigger #1
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: Build and Publish | |
| on: | |
| push: | |
| tags: | |
| - 'v*' | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| permissions: | |
| contents: write | |
| jobs: | |
| linux: | |
| runs-on: ubuntu-22.04 | |
| env: | |
| MIX_ENV: prod | |
| HNSWLIB_CI_PRECOMPILE: "true" | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| otp_version: [25, 26] | |
| name: Linux GNU - OTP ${{ matrix.otp_version }} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - uses: erlef/setup-beam@v1 | |
| with: | |
| otp-version: ${{ matrix.otp_version }} | |
| elixir-version: 1.15 | |
| - name: Install system dependecies | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y build-essential automake autoconf pkg-config bc m4 unzip zip \ | |
| gcc-aarch64-linux-gnu g++-aarch64-linux-gnu \ | |
| gcc-arm-linux-gnueabihf g++-arm-linux-gnueabihf \ | |
| gcc-riscv64-linux-gnu g++-riscv64-linux-gnu \ | |
| gcc-powerpc64le-linux-gnu g++-powerpc64le-linux-gnu | |
| - name: Precompile | |
| run: | | |
| export ELIXIR_MAKE_CACHE_DIR=$(pwd)/cache | |
| mkdir -p "${ELIXIR_MAKE_CACHE_DIR}" | |
| mix deps.get | |
| mix elixir_make.precompile | |
| - name: Upload artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: linux-otp-${{ matrix.otp_version }} | |
| path: | | |
| cache/*.tar.gz | |
| cache/*.sha256 | |
| macos: | |
| runs-on: macos-15 | |
| env: | |
| MIX_ENV: prod | |
| ELIXIR_VERSION: "1.16.0" | |
| OTP_VERSION: ${{ matrix.otp_version }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| otp_version: ["25.3.2.8", "26.2.2"] | |
| name: macOS - OTP ${{ matrix.otp_version }} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Install OTP and Elixir | |
| run: | | |
| curl -fsSO https://elixir-lang.org/install.sh | |
| sh install.sh "elixir@${ELIXIR_VERSION}" "otp@${OTP_VERSION}" | |
| - name: Precompile | |
| run: | | |
| export OTP_MAIN_VER="${OTP_VERSION%%.*}" | |
| export PATH=$HOME/.elixir-install/installs/otp/${OTP_VERSION}/bin:$PATH | |
| export PATH=$HOME/.elixir-install/installs/elixir/${ELIXIR_VERSION}-otp-${OTP_MAIN_VER}/bin:$PATH | |
| export ELIXIR_MAKE_CACHE_DIR=$(pwd)/cache | |
| mkdir -p "${ELIXIR_MAKE_CACHE_DIR}" | |
| mix local.hex --force | |
| mix local.rebar --force | |
| mix deps.get | |
| mix elixir_make.precompile | |
| - name: Upload artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: macos-otp-${{ matrix.otp_version }} | |
| path: | | |
| cache/*.tar.gz | |
| cache/*.sha256 | |
| windows: | |
| runs-on: windows-2022 | |
| env: | |
| MIX_ENV: prod | |
| ImageOS: win22 | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| otp_version: [25, 26] | |
| name: Windows - OTP ${{ matrix.otp_version }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: erlef/setup-beam@v1 | |
| with: | |
| otp-version: ${{ matrix.otp_version }} | |
| elixir-version: 1.15 | |
| - uses: ilammy/msvc-dev-cmd@v1 | |
| with: | |
| arch: x64 | |
| - name: Precompile | |
| shell: bash | |
| run: | | |
| export ELIXIR_MAKE_CACHE_DIR=$(pwd)/cache | |
| mkdir -p "${ELIXIR_MAKE_CACHE_DIR}" | |
| mix deps.get | |
| mix elixir_make.precompile | |
| - name: Upload artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: windows-otp-${{ matrix.otp_version }} | |
| path: | | |
| cache/*.tar.gz | |
| cache/*.sha256 | |
| manylinux: | |
| runs-on: ubuntu-latest | |
| env: | |
| MIX_ENV: prod | |
| OPENSSL_VERSION: "3.2.1" | |
| ELIXIR_VERSION: "v1.15.4" | |
| HNSWLIB_CI_PRECOMPILE: "manylinux2014" | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| otp_version: ["25.3.2.9", "26.2.2"] | |
| arch: [x86_64, i686, s390x] | |
| name: ${{ matrix.arch }}-linux-gnu - OTP ${{ matrix.otp_version }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Pull docker image | |
| run: | | |
| sudo docker pull quay.io/pypa/manylinux2014_${{ matrix.arch }}:latest | |
| - name: Install binfmt | |
| run: | | |
| sudo apt install -y binfmt-support qemu-user-static | |
| - name: Precompile | |
| run: | | |
| cp .github/script-to-build-manylinux2014.sh ./ | |
| cp .github/do-build-manylinux2014.sh ./ | |
| bash ./script-to-build-manylinux2014.sh "${{ env.MIX_ENV }}" "${{ matrix.otp_version }}" "${{ env.ELIXIR_VERSION }}" "${{ env.OPENSSL_VERSION }}" "${{ matrix.arch }}" "${{ env.HNSWLIB_CI_PRECOMPILE }}" | |
| - name: Upload artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: manylinux-${{ matrix.arch }}-otp-${{ matrix.otp_version }} | |
| path: | | |
| cache/*.tar.gz | |
| cache/*.sha256 | |
| publish: | |
| needs: [linux, macos, windows, manylinux] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Download all artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| path: artifacts | |
| - name: Flatten artifacts | |
| run: | | |
| mkdir -p release | |
| find artifacts -type f \( -name "*.tar.gz" -o -name "*.sha256" \) -exec cp {} release/ \; | |
| ls -la release/ | |
| - name: Create GitHub release | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| TAG_NAME: ${{ github.ref_name }} | |
| run: | | |
| gh release create "$TAG_NAME" release/* --repo ${{ github.repository }} --generate-notes | |
| - uses: erlef/setup-beam@v1 | |
| with: | |
| otp-version: 26 | |
| elixir-version: 1.16 | |
| - name: Generate checksum.exs | |
| run: | | |
| mix deps.get | |
| mix elixir_make.checksum --all --ignore-unavailable | |
| - name: Commit checksum.exs | |
| env: | |
| TAG_NAME: ${{ github.ref_name }} | |
| run: | | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| git add checksum.exs | |
| git commit -m "Add checksum.exs for $TAG_NAME" | |
| git push origin HEAD:main | |
| - name: Publish to Hex | |
| env: | |
| HEX_API_KEY: ${{ secrets.HEX_API_KEY }} | |
| run: | | |
| mix hex.publish --yes |