on:
  workflow_dispatch:

name: Release Elixir SDK

jobs:
  release-sdks:
    name: release-elixir
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v3
      - name: Install extism shared library
        shell: bash
        run: |
          mkdir -p /home/runner/.local/bin/  
          export PATH="/home/runner/.local/bin/:$PATH"
          curl https://raw.githubusercontent.com/extism/cli/main/install.sh | sh
          extism --sudo --prefix /usr/local install
      - name: Setup Elixir Host SDK
        uses: erlef/setup-beam@v1
        with:
          experimental-otp: true
          otp-version: '25.0.4'
          elixir-version: '1.14.0'

      - name: Publish Elixir Host SDK to hex.pm
        env:
          HEX_API_KEY: ${{ secrets.HEX_PM_API_TOKEN }}
        run: |
          cd elixir
          cp ../LICENSE .
          make publish
  
