-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- rename workflow (fix typo) - remove ssh key setup - trigger only if not pre-release - check version number - use correctly hex.pm
- Loading branch information
1 parent
422f04d
commit ae4429f
Showing
2 changed files
with
44 additions
and
45 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |