-
Notifications
You must be signed in to change notification settings - Fork 1
77 lines (64 loc) · 1.76 KB
/
Copy pathpublish.yml
File metadata and controls
77 lines (64 loc) · 1.76 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
name: Publish to Hex.pm
on:
push:
tags:
- 'v*.*.*'
- 'v*.*.*-rc.*'
- 'v*.*.*-beta.*'
- 'v*.*.*-alpha.*'
env:
MIX_ENV: prod
ELIXIR_VERSION: "1.18"
OTP_VERSION: "27"
jobs:
publish:
name: Publish to Hex.pm
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Elixir
uses: erlef/setup-beam@v1
with:
elixir-version: ${{ env.ELIXIR_VERSION }}
otp-version: ${{ env.OTP_VERSION }}
- name: Cache dependencies
uses: actions/cache@v3
with:
path: |
deps
_build
key: ${{ runner.os }}-mix-publish-${{ hashFiles('**/mix.lock') }}
restore-keys: |
${{ runner.os }}-mix-publish-
- name: Install dependencies
run: |
mix deps.get --only prod
MIX_ENV=dev mix deps.get --only dev
- name: Compile project
run: |
mix compile
MIX_ENV=dev mix compile
- name: Run tests
run: mix test --exclude slow --exclude omnetpp
- name: Build documentation
env:
MIX_ENV: dev
run: mix docs
- name: Publish to Hex
env:
HEX_API_KEY: ${{ secrets.HEX_API_KEY }}
MIX_ENV: dev
run: |
mix hex.publish --yes --replace
- name: Create GitHub Release
if: startsWith(github.ref, 'refs/tags/')
uses: softprops/action-gh-release@v2
with:
generate_release_notes: true
prerelease: ${{ contains(github.ref, '-rc.') || contains(github.ref, '-beta.') || contains(github.ref, '-alpha.') }}
files: |
CHANGELOG.md