-
Notifications
You must be signed in to change notification settings - Fork 1
58 lines (45 loc) · 1.3 KB
/
publish_release.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
name: Publish Release
on:
release:
types: [created]
jobs:
publish:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up Elixir
uses: actions/setup-elixir@v1
with:
elixir-version: 1.15
otp-version: 24.0
- name: Install Dependencies
run: mix deps.get
- name: Update version in mix.exs
run: |
VERSION=${{ github.ref }}
VERSION=${VERSION#refs/tags/v}
sed -i "s/version: \".*\"/version: \"$VERSION\"/" mix.exs
- name: Commit changes
run: |
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
git commit -m "Update version in mix.exs to $VERSION" -a
- name: Push changes
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: ${{ github.ref }}
- name: Delete existing tag
run: git tag -d v$VERSION || true
- name: Push tag deletion
run: git push origin :refs/tags/v$VERSION || true
- name: Tag the commit
run: git tag v$VERSION
- name: Push tags
run: git push --tags
- name: Publish to Hex
run: |
mix hex.publish --yes
env:
HEX_API_KEY: ${{ secrets.HEX_API_KEY }}