diff --git a/.github/workflows/release-elixir.yml b/.github/workflows/release-elixir.yml new file mode 100644 index 0000000..a5288c9 --- /dev/null +++ b/.github/workflows/release-elixir.yml @@ -0,0 +1,61 @@ +name: Release Elixir (Hex.pm) + +on: + push: + tags: + - "ex-v*" + +permissions: + contents: read + +jobs: + build-and-publish: + runs-on: ubuntu-latest + environment: production + defaults: + run: + working-directory: sdks/ex_sdk + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Extract version from tag + id: vars + shell: bash + run: | + TAG="${GITHUB_REF#refs/tags/}" + VERSION="${TAG#ex-v}" + echo "tag_version=$VERSION" >> "$GITHUB_OUTPUT" + + - name: Setup Erlang/Elixir + uses: erlef/setup-beam@v1 + with: + otp-version: "26" + elixir-version: "1.16" + + - name: Install Hex and Rebar + run: | + mix local.hex --force + mix local.rebar --force + + - name: Install dependencies + run: mix deps.get + + - name: Verify version matches mix.exs + shell: bash + run: | + FILE_VERSION=$(grep -m1 '@version "' mix.exs | sed -E 's/.*"([^"]+)".*/\1/') + echo "Tag version: ${{ steps.vars.outputs.tag_version }}" + echo "File version: $FILE_VERSION" + if [ "$FILE_VERSION" != "${{ steps.vars.outputs.tag_version }}" ]; then + echo "Version mismatch: tag ${{ steps.vars.outputs.tag_version }} vs mix.exs $FILE_VERSION" >&2 + exit 1 + fi + + - name: Run tests + run: mix test + + - name: Publish to Hex.pm + env: + HEX_API_KEY: ${{ secrets.HEX_API_KEY }} + run: mix hex.publish --yes diff --git a/.github/workflows/release-notes.yml b/.github/workflows/release-notes.yml index 869c279..ab6bd3d 100644 --- a/.github/workflows/release-notes.yml +++ b/.github/workflows/release-notes.yml @@ -6,6 +6,8 @@ on: - 'py-v*' - 'rs-v*' - 'npm-v*' + - 'cl-v*' + - 'ex-v*' permissions: contents: write @@ -34,6 +36,20 @@ jobs: python sdks/rust_sdk/scripts/release_notes.py --tag "$TAG" > NOTES.md elif [[ "$TAG" == npm-v* ]]; then python sdks/js_sdk/scripts/release_notes.py --tag "$TAG" > NOTES.md + elif [[ "$TAG" == cl-v* ]]; then + cat > NOTES.md < NOTES.md <&2 exit 1 diff --git a/sdks/ex_sdk/mix.exs b/sdks/ex_sdk/mix.exs index b0907a0..fb9396f 100644 --- a/sdks/ex_sdk/mix.exs +++ b/sdks/ex_sdk/mix.exs @@ -14,6 +14,7 @@ defmodule Sw4rm.MixProject do name: "SW4RM SDK", description: "Elixir SDK for the SW4RM multi-agent coordination protocol", source_url: "https://github.com/sw4rm/sw4rm-sdk-elixir", + package: package(), docs: [main: "Sw4rm", extras: ["README.md"]] ] end @@ -40,6 +41,16 @@ defmodule Sw4rm.MixProject do ] end + defp package do + [ + licenses: ["Apache-2.0"], + links: %{ + "GitHub" => "https://github.com/rahulrajaram/sw4rm", + "Protocol Docs" => "https://github.com/rahulrajaram/sw4rm/tree/master/documentation" + } + ] + end + defp proto_gen(_args) do protos_dir = Path.join([__DIR__, "..", "rust_sdk", "protos"]) out_dir = Path.join([__DIR__, "lib", "sw4rm", "proto"])