Skip to content

Commit

Permalink
chore: fix publish public package
Browse files Browse the repository at this point in the history
- rename workflow (fix typo)
- remove ssh key setup
- trigger only if not pre-release
- check version number
- use correctly hex.pm
  • Loading branch information
davidjulien committed Nov 8, 2024
1 parent 422f04d commit ae4429f
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 45 deletions.
45 changes: 0 additions & 45 deletions .github/workflows/publich_public_package.yml

This file was deleted.

44 changes: 44 additions & 0 deletions .github/workflows/publish_public_package.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Publish package to Hex.pm

on:
release:
types: [released]

jobs:
publish:
runs-on: ubuntu-latest
if: "!github.event.release.prerelease"

steps:
- uses: actions/checkout@v4

- name: Set up Elixir
uses: erlef/setup-beam@v1
with:
elixir-version: '1.17.2'
otp-version: '26.2.5.2'

- name: Install dependencies
run: |
mix deps.get
- name: Compile
run: |
mix compile
- name: Check version consistency
run: |
MIX_VERSION=$(mix run -e 'IO.puts Mix.Project.config[:version]')
RELEASE_VERSION=${{ github.event.release.tag_name }}
RELEASE_VERSION=${RELEASE_VERSION#v}
if [ "$MIX_VERSION" != "$RELEASE_VERSION" ]; then
echo "Version mismatch: mix.exs version ($MIX_VERSION) != release version ($RELEASE_VERSION)"
exit 1
fi
- name: Publish to Hex.pm
env:
HEX_API_KEY: ${{ secrets.HEXPM_PUBLIC_PACKAGES_KEY }}
run: |
mix hex.publish --yes

0 comments on commit ae4429f

Please sign in to comment.