Skip to content

Commit

Permalink
[add] publish step
Browse files Browse the repository at this point in the history
  • Loading branch information
zoten committed Sep 15, 2023
1 parent 25b14e9 commit 7fc1de0
Showing 1 changed file with 41 additions and 4 deletions.
45 changes: 41 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ on:
- master

jobs:
redact_ex:
test:
# runs-on: [self-hosted, k8s-medium]
runs-on: ubuntu-latest
env:
Expand Down Expand Up @@ -71,12 +71,49 @@ jobs:
run: mix test
- name: Dialyzer
run: mix dialyzer


publish:
name: Publish to hex.pm
needs: test
if: github.ref_type == 'tag'
runs-on: ubuntu-latest
steps:
- name: Setup Elixir
uses: erlef/setup-beam@v1
# TODO optimize here to be in sync with the matrix above?
with:
otp-version: 25.0.4
elixir-version: 1.14.3
- name: Checkout
uses: actions/checkout@v3
- name: setup hex
run: |
mix mix local.hex --force
mix local.rebar --force
- name: get deps
run: mix deps.get
- name: get tag
run: |
REDACT_EX_VERSION_REPO=$(grep -m1 version mix.exs | cut -d'"' -f2)
echo "REDACT_EX_VERSION_REPO=$REDACT_EX_VERSION_REPO" >> $GITHUB_ENV
- name: check tags
if: github.ref_tag != ${{ env.REDACT_EX_VERSION_REPO }}
run: |
echo "Github ref tag [${{ github.ref_tag }}] is different from mix.exs version [${{ env.REDACT_EX_VERSION_REPO }}]"
exit 1
- name: Login to hex.pm
run: |
mix hex.config api_key "$HEX_AUTH_KEY"
env:
HEX_AUTH_KEY: ${{ secrets.HEX_AUTH_KEY }}
- name: Publish
run: mix hex.publish --yes

alls-green:
if: always()

needs:
- redact_ex
- test
- publish
# runs-on: [self-hosted, k8s-small]
runs-on: ubuntu-latest
container:
Expand Down

0 comments on commit 7fc1de0

Please sign in to comment.