diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9f62926..0aa933c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -17,7 +17,7 @@ jobs: matrix: os: ['ubuntu-24.04'] otp: ['28', '27', '26'] - rebar3: ['3.25.0'] + rebar3: ['3.27'] steps: - uses: actions/checkout@v4 - uses: erlef/setup-beam@v1 @@ -41,7 +41,7 @@ jobs: matrix: os: ['ubuntu-24.04'] otp: ['28', '27', '26'] - rebar3: ['3.25.0'] + rebar3: ['3.27'] steps: - uses: actions/checkout@v4 - uses: erlef/setup-beam@v1 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..ab30256 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,23 @@ +name: Publish to Hex + +on: + release: + types: [ released ] # pre- and draft releases are excluded + workflow_dispatch: + +permissions: + contents: read + +jobs: + publish: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v6 + - uses: erlef/setup-beam@v1 + with: + otp-version: "28" + rebar3-version: "3.27" + - run: rebar3 compile + - run: rebar3 hex publish -r hexpm --yes + env: + HEX_API_KEY: ${{ secrets.HEX_API_KEY }} diff --git a/.github/workflows/revert-release.yml b/.github/workflows/revert-release.yml new file mode 100644 index 0000000..42f8770 --- /dev/null +++ b/.github/workflows/revert-release.yml @@ -0,0 +1,25 @@ +name: Revert published version from Hex + +on: + workflow_dispatch: + inputs: + version: + description: "Package version to revert (e.g. 1.0.0)" + required: true + type: string + +permissions: + contents: read + +jobs: + revert: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v6 + - uses: erlef/setup-beam@v1 + with: + otp-version: "28" + rebar3-version: "3.27" + - run: rebar3 hex publish --revert ${{ inputs.version }} -r hexpm --yes + env: + HEX_API_KEY: ${{ secrets.HEX_API_KEY }} diff --git a/README.md b/README.md index eea7a88..b929af2 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,7 @@ Some features are not supported: Developed by [Erlang Solutions](https://www.erlang-solutions.com/) to be used in [MongooseIM](https://github.com/esl/MongooseIM/). It could be used in other Erlang or Elixir projects. -# Merging logic +## Merging logic When two database partitions are joined together, records from both partitions are put together. So, each record would be present on each node. @@ -42,7 +42,7 @@ Without `handle_conflict`, conflicting records would overwrite each other when j When joining nodes we insert all data from one node to another and vice versa without any extra check. Check `join_works_with_existing_data_with_conflicts` test case as an example. -# API +## API The main module is cets. @@ -73,10 +73,18 @@ The simplest `cets_discovery` backend is `cets_discovery_file`, which just reads a file with a list of nodes on each line. This file could be populated by an external program or by an admin. -# Commands +## Commands Before making a new pull request run tests: ``` rebar3 all ``` + +## Releasing to Hex.pm + +Creating a GitHub release (non-draft, non-prerelease) automatically publishes the package to [Hex.pm](https://hex.pm/) via the **Publish to Hex** workflow. +This workflow can also be triggered manually from the Actions tab — make sure to run it from the specific tag you want to publish. + +To revert a published version, run the **Revert published version from Hex** workflow from the Actions tab, providing the version to revert. +Hex.pm only allows reverting within 1 hour of publishing — after that, the version can only be *retired*.