-
Notifications
You must be signed in to change notification settings - Fork 1
95 lines (83 loc) · 2.53 KB
/
releaser.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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
name: "Automatic Releaser"
on:
push:
branches:
- main
permissions:
contents: write
jobs:
check-commit:
runs-on: ubuntu-latest
outputs:
msg_check: ${{ steps.check-msg.outputs.match }}
steps:
- name: Check Message
id: check-msg
run: |
pattern="^Release v[0-9]+.[0-9]+.[0-9]+ #(minor|major|patch)$"
if [[ "${{ github.event.head_commit.message }}" =~ ${pattern} ]]; then
echo ::set-output name=match::true
fi
create-tag:
runs-on: ubuntu-latest
if: needs.check-commit.outputs.msg_check == 'true'
needs: check-commit
outputs:
new_tag: ${{ steps.tagger.outputs.new_tag }}
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Bump version and push tag
id: tagger
uses: anothrNick/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
WITH_V: true
DEFAULT_BUMP: "none"
create-release:
runs-on: ubuntu-latest
needs: [create-tag]
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.21'
- name: Docker Login
run: |
echo "${{ secrets.DOCKER_PASSWORD }}" | docker login --username "${{ secrets.DOCKER_USERNAME }}" --password-stdin
- name: Build and Push Docker Image
run: |
make docker-build
make docker-push
env:
TAG: ${{ needs.create-tag.outputs.new_tag }}
- name: Create Release Artifacts
run: make release
env:
RELEASE_TAG: ${{ github.ref_name }}
- name: Upload Release Artifacts
uses: softprops/action-gh-release@v2
with:
files: |
./out/*
tag_name: ${{ needs.create-tag.outputs.new_tag }}
- name: Clear
if: always()
run: |
rm -f ${HOME}/.docker/config.json
release-notification:
runs-on: ubuntu-latest
needs: ["create-release"]
name: Release Notification
steps:
- uses: mattermost/[email protected]
with:
MATTERMOST_WEBHOOK_URL: ${{ secrets.MATTERMOST_WEBHOOK_URL }}
MATTERMOST_USERNAME: ${{ secrets.MATTERMOST_USERNAME}}
MATTERMOST_ICON_URL: ${{ secrets.MATTERMOST_ICON }}
TEXT: "${{ github.repository }} : Release https://github.com/${{ github.repository }}/releases/tag/${{ github.ref_name }}"