Skip to content

Commit

Permalink
build: automate publishing of hex package
Browse files Browse the repository at this point in the history
  • Loading branch information
efcasado committed May 9, 2024
1 parent e56b861 commit d403174
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 3 deletions.
18 changes: 18 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: publish

on:
release:
types: [created]

jobs:
build:
name: publish package to hex
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: publish package to hex
shell: 'script -q -e -c "bash --noprofile --norc -eo pipefail {0}"'
run: make publish
env:
HEX_API_KEY: ${{ secrets.HEX_API_KEY }}
2 changes: 1 addition & 1 deletion .rc
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
function mix() {
ELIXIR_VERSION=${ELIXIR_VERSION:-1.15.6}
DOCKER_IMAGE=elixir:${ELIXIR_VERSION}
DOCKER_RUN_OPTS="--rm -it --network host -v /etc/passwd:/etc/passwd:ro -v /etc/group:/etc/group:ro -u $(id -u):$(id -g) -v ${PWD}:${PWD} -w ${PWD} -e HEX_HOME=${PWD} -e MIX_HOME=${PWD} -e UOF_BASE_URL -e UOF_AUTH_TOKEN ${DOCKER_RUN_EXTRA_OPTS}"
DOCKER_RUN_OPTS="--rm -it --network host -v /etc/passwd:/etc/passwd:ro -v /etc/group:/etc/group:ro -u $(id -u):$(id -g) -v ${PWD}:${PWD} -w ${PWD} -e HEX_HOME=${PWD} -e MIX_HOME=${PWD} -e UOF_BASE_URL -e UOF_AUTH_TOKEN -e HEX_API_KEY ${DOCKER_RUN_EXTRA_OPTS}"
if [ -n "$ZSH_VERSION" ]; then
docker run ${=DOCKER_RUN_OPTS} ${DOCKER_IMAGE} mix "$@"
else
Expand Down
5 changes: 4 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.PHONY: all deps compile format test docs shell
.PHONY: all deps compile format test docs shell publish

ifndef NODOCKER
SHELL := BASH_ENV=.rc /bin/bash --noprofile
Expand Down Expand Up @@ -27,3 +27,6 @@ docs:

shell: compile
iex -S mix

publish:
mix hex.publish --yes --dry-run
18 changes: 17 additions & 1 deletion mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,11 @@ defmodule UofApi.MixProject do
version: "1.0.0",
elixir: "~> 1.15",
start_permanent: Mix.env() == :prod,
deps: deps()
description: description(),
package: package(),
deps: deps(),
name: "UOF API",
source_url: "https://github.com/efcasado/uof_api"
]
end

Expand All @@ -28,4 +32,16 @@ defmodule UofApi.MixProject do
{:mock, "~> 0.3.8", only: :test}
]
end

defp description() do
"An Elixir client for Betradar's Unified Odds Feed (UOF) API"
end

defp package() do
[
name: "UOF API",
licenses: ["MIT"],
links: %{"GitHub" => "https://github.com/efcasado/uof_api"}
]
end
end

0 comments on commit d403174

Please sign in to comment.