Skip to content

Commit 422f04d

Browse files
authored
Merge pull request #131 from WTTJ/chore/add-workflow-to-publish-package
chore: add github workflow to publish package on release
2 parents 00fa599 + 7c834b2 commit 422f04d

File tree

1 file changed

+45
-0
lines changed

1 file changed

+45
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: Publish package to Hex.pm
2+
3+
on:
4+
release:
5+
types: [published]
6+
7+
jobs:
8+
publish:
9+
runs-on: ubuntu-latest
10+
11+
steps:
12+
- name: Set up SSH key
13+
uses: webfactory/[email protected]
14+
with:
15+
ssh-private-key: ${{ secrets.WTTJ_DEPLOYER }}
16+
17+
- uses: actions/checkout@v4
18+
19+
- name: Set up Elixir
20+
uses: erlef/setup-beam@v1
21+
with:
22+
elixir-version: '1.17.2'
23+
otp-version: '26.2.5.2'
24+
25+
- name: Extract library name and version
26+
run: |
27+
RELEASE_NAME=${{ github.event.release.tag_name }}
28+
VERSION=$(echo $RELEASE_NAME | cut -d'v' -f2)
29+
echo "LIB_NAME=$LIB_NAME" >> $GITHUB_ENV
30+
echo "VERSION=$VERSION" >> $GITHUB_ENV
31+
32+
- name: Configure package access
33+
run: |
34+
mix local.hex --force
35+
mix hex.organization auth wttj --key ${{ secrets.HEXPM_KEY }}
36+
37+
- name: Install dependencies
38+
run: |
39+
mix deps.get
40+
41+
- name: Publish to Hex.pm
42+
env:
43+
HEX_API_KEY: ${{ secrets.HEXPM_KEY }}
44+
run: |
45+
mix hex.publish --yes

0 commit comments

Comments
 (0)