chore: add automatic publishing of new releases to hex. (#66)

This commit is contained in:
James Harton 2022-12-08 15:35:53 +13:00 committed by GitHub
parent afe6779b2a
commit d8e1281c9b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 35 additions and 15 deletions

View file

@ -0,0 +1,33 @@
name: Release an Elixir Library
on:
release:
types: [published]
jobs:
deps:
name: mix deps.get
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: team-alembic/staple-actions/actions/mix-deps-get@main
build-dev:
name: MIX_ENV=dev mix.compile
runs-on: ubuntu-latest
needs: deps
steps:
- uses: actions/checkout@v3
- uses: team-alembic/staple-actions/actions/mix-compile@main
with:
mix-env: dev
publish:
name: MIX_ENV=dev mix hex.publish
runs-on: ubuntu-latest
needs: build-dev
steps:
- uses: actions/checkout@v3
- uses: team-alembic/staple-actions/actions/mix-hex-publish@main
with:
mix-env: dev
hex-api-key: ${{ secrets.HEX_API_KEY }}

View file

@ -9,7 +9,7 @@ defmodule AshAuthentication.TokenResource.Transformer do
require Ash.Expr require Ash.Expr
alias Ash.{Resource, Type} alias Ash.{Resource, Type}
alias AshAuthentication.{TokenResource, TokenResource.Info} alias AshAuthentication.{TokenResource, TokenResource.Info}
alias Spark.{Dsl.Transformer, Error.DslError} alias Spark.Dsl.Transformer
import AshAuthentication.Utils import AshAuthentication.Utils
import AshAuthentication.Validations import AshAuthentication.Validations
@ -306,20 +306,6 @@ defmodule AshAuthentication.TokenResource.Transformer do
defp build_expunge_expired_action(_dsl_state, action_name), defp build_expunge_expired_action(_dsl_state, action_name),
do: Transformer.build_entity(Resource.Dsl, [:actions], :destroy, name: action_name) do: Transformer.build_entity(Resource.Dsl, [:actions], :destroy, name: action_name)
defp validate_api_presence(dsl_state) do
case Transformer.get_option(dsl_state, [:token], :api) do
nil ->
{:error,
DslError.exception(
path: [:token, :api],
message: "An API module must be present"
)}
api ->
{:ok, api}
end
end
defp validate_jti_field(dsl_state) do defp validate_jti_field(dsl_state) do
with {:ok, resource} <- persisted_option(dsl_state, :module), with {:ok, resource} <- persisted_option(dsl_state, :module),
{:ok, attribute} <- find_attribute(dsl_state, :jti), {:ok, attribute} <- find_attribute(dsl_state, :jti),

View file

@ -8,6 +8,7 @@ defmodule AshAuthentication.MixProject do
[ [
app: :ash_authentication, app: :ash_authentication,
version: @version, version: @version,
description: "User authentication support for Ash",
elixir: "~> 1.13", elixir: "~> 1.13",
start_permanent: Mix.env() == :prod, start_permanent: Mix.env() == :prod,
preferred_cli_env: [ci: :test], preferred_cli_env: [ci: :test],