-
Notifications
You must be signed in to change notification settings - Fork 0
78 lines (66 loc) · 2 KB
/
publish.yml
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
77
78
name: Publish
on:
workflow_dispatch:
jobs:
version:
name: Calculate version
runs-on: ubuntu-latest
outputs:
version: ${{ steps.versioning.outputs.version-string }}
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Calculate semantic version
id: versioning
uses: bitshifted/git-auto-semver@v1.1.0
with:
main_branch: main
create_tag: true
tag_prefix: "v"
publish:
name: Publish to Hex.pm
needs: version
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Calculate semantic version
id: versioning
uses: bitshifted/git-auto-semver@v1.1.0
with:
main_branch: main
create_tag: false
tag_prefix: 'v'
- name: Update version in mix.exs
env:
RELEASE_VERSION: ${{ steps.versioning.outputs.version-string }}
run: |
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git config --global user.name "github-actions[bot]"
sed -i "s/version: \".*\"/version: \"${RELEASE_VERSION#v}\"/" mix.exs
git add mix.exs
git commit -m "chore: Bump version to ${RELEASE_VERSION}"
git push
- name: Create GitHub Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
VERSION=${{ steps.versioning.outputs.version-string }}
git tag $VERSION
git push origin $VERSION
gh release create $VERSION \
--title "Release $VERSION" \
--generate-notes
- name: Set up Elixir
uses: erlef/setup-beam@v1
with:
elixir-version: "1.16.2"
otp-version: "26.2.5"
- name: Install dependencies
run: mix deps.get
- name: Generate docs
run: mix docs
- name: Publish to Hex.pm
env:
HEX_API_KEY: ${{ secrets.HEX_API_KEY }}
run: mix hex.publish --yes