generated from gotify/plugin-template
-
Notifications
You must be signed in to change notification settings - Fork 0
122 lines (103 loc) · 3.4 KB
/
build.yaml
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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
name: Build and Release
on:
push:
branches:
- main
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: 'stable'
- name: Download tools
run: make download-tools
- name: Run tests
run: make test
create-tag:
needs: test
runs-on: ubuntu-latest
permissions:
contents: write
outputs:
new_version: ${{ steps.tag_version.outputs.new_version }}
tag: ${{ steps.tag_version.outputs.new_tag }}
supported_versions: ${{ steps.versions.outputs.versions }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Read versions file
id: versions
run: |
VERSIONS=$(cat SUPPORTED_GOTIFY_VERSIONS.txt | jq -R -s -c 'split("\n")[:-1]')
echo "versions=$VERSIONS" >> $GITHUB_OUTPUT
- name: Create Tag
id: tag_version
uses: mathieudutour/[email protected]
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
default_bump: patch
build:
needs: create-tag
runs-on: ubuntu-latest
strategy:
matrix:
gotify_version: ${{ fromJson(needs.create-tag.outputs.supported_versions) }}
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: 'stable'
- name: Download tools
run: make download-tools
- name: Build plugin
run: >-
make
GOTIFY_VERSION="${{ matrix.gotify_version }}"
FILE_SUFFIX="-v${{ needs.create-tag.outputs.new_version }}-for-gotify-${{ matrix.gotify_version }}"
LD_FLAGS="-X main.Version=${{ needs.create-tag.outputs.new_version }}"
build
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
name: plugin-${{ matrix.gotify_version }}
path: build/*.so
release:
needs:
- create-tag
- build
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- name: Generate version list
id: versions
run: |
version_list=$(cat SUPPORTED_GOTIFY_VERSIONS.txt | sed 's/^/- /')
echo "version_list<<EOF" >> $GITHUB_ENV
echo "$version_list" >> $GITHUB_ENV
echo "EOF" >> $GITHUB_ENV
- name: Download all artifacts
uses: actions/download-artifact@v3
- name: Display structure of downloaded files
run: ls -R
- name: Create Release
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ needs.create-tag.outputs.tag }}
name: Release ${{ needs.create-tag.outputs.tag }}
files: plugin-*/gotify-to-telegram-*.so
generate_release_notes: true
body: |
## Supported Gotify Versions
${{ env.version_list }}
## Installation
Download the appropriate plugin file for your architecture and Gotify version:
- AMD64: `gotify-to-telegram-linux-amd64-v${{ needs.create-tag.outputs.new_version }}-for-gotify-*.so`
- ARM64: `gotify-to-telegram-linux-arm64-v${{ needs.create-tag.outputs.new_version }}-for-gotify-*.so`
- ARM7: `gotify-to-telegram-linux-arm-7-v${{ needs.create-tag.outputs.new_version }}-for-gotify-*.so`