Skip to content

Commit

Permalink
CD workflow to publish to hex.pm (#2)
Browse files Browse the repository at this point in the history
  • Loading branch information
paveltyk authored Mar 26, 2024
1 parent a57ce30 commit 801225c
Showing 1 changed file with 40 additions and 0 deletions.
40 changes: 40 additions & 0 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: CD

on:
release:
types: [published]

jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Setup Elixir
uses: erlef/setup-beam@v1
with:
otp-version: "25"
elixir-version: "1.14"
- name: Checkout
uses: actions/checkout@v3
- name: Setup hex
run: |
mix local.hex --force
mix local.rebar --force
- name: Get deps
run: mix deps.get
- name: Get version
run: |
VERSION=$(grep -m1 version mix.exs | cut -d'"' -f2)
echo "VERSION=$VERSION" >> $GITHUB_ENV
- name: Check version
if: ${{ github.event.release.tag_name != env.VERSION }}
run: |
echo "Github ref tag [${{ github.event.release.tag_name }}] is different from mix.exs version [${{ env.VERSION }}]"
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 to hex.pm
run: mix hex.publish --yes
env:
MIX_ENV: docs

0 comments on commit 801225c

Please sign in to comment.