From 8d173f88524f667511e51440cab32908fdcdf4f6 Mon Sep 17 00:00:00 2001 From: Eduardo Cunha Date: Mon, 29 Jul 2024 13:34:32 +0100 Subject: [PATCH] chore: improve release action --- .github/workflows/release.yml | 25 ++++++++++++++----------- config/config.exs | 4 +++- config/dev.exs | 1 - config/test.exs | 3 --- mix.exs | 7 ++++++- 5 files changed, 23 insertions(+), 17 deletions(-) delete mode 100644 config/dev.exs delete mode 100644 config/test.exs diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 9ccafb4..50b7020 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -14,23 +14,26 @@ jobs: - name: Checkout uses: actions/checkout@v4 with: - ref: main + ref: ${{ github.event.release.tag_name}} - uses: erlef/setup-beam@v1 with: otp-version: 27.0 elixir-version: 1.17 - - uses: actions/cache@v4 - with: - path: | - deps - _build - key: ${{ runner.os }}-mix-1.17-27.0-${{ hashFiles('**/mix.lock') }} - restore-keys: | - ${{ runner.os }}-mix-1.17-27.0- - - - name: Hex publish + - name: Run mix deps.get + run: mix deps.get --only docs + + - name: Run mix deps.compile + run: mix deps.compile + + - name: Run mix compile + run: mix compile + env: + MIX_ENV: docs + + - name: Run mix hex.publish run: mix hex.publish --yes env: HEX_API_KEY: ${{ secrets.HEX_API_KEY }} + MIX_ENV: docs diff --git a/config/config.exs b/config/config.exs index d1186fe..35c2fe2 100644 --- a/config/config.exs +++ b/config/config.exs @@ -1,3 +1,5 @@ import Config -import_config "#{config_env()}.exs" +if config_env() == :test do + config :logger, backends: [] +end diff --git a/config/dev.exs b/config/dev.exs deleted file mode 100644 index becde76..0000000 --- a/config/dev.exs +++ /dev/null @@ -1 +0,0 @@ -import Config diff --git a/config/test.exs b/config/test.exs deleted file mode 100644 index 7c10aa5..0000000 --- a/config/test.exs +++ /dev/null @@ -1,3 +0,0 @@ -import Config - -config :logger, backends: [] diff --git a/mix.exs b/mix.exs index 9359366..9515c62 100644 --- a/mix.exs +++ b/mix.exs @@ -9,6 +9,11 @@ defmodule OpenFeature.MixProject do start_permanent: Mix.env() == :prod, test_paths: ["test/unit", "test/integration"], deps: deps(), + preferred_cli_env: [ + test: :test, + docs: :docs, + "hex.publish": :docs + ], # Docs name: "OpenFeature", @@ -33,7 +38,7 @@ defmodule OpenFeature.MixProject do [ {:credo, "~> 1.7", only: [:dev, :test], runtime: false}, {:dialyxir, "~> 1.4", only: [:dev, :test], runtime: false}, - {:ex_doc, "~> 0.34", only: [:dev, :test], runtime: false}, + {:ex_doc, "~> 0.34", only: :docs, runtime: false}, {:mimic, "~> 1.9", only: :test} ] end