-
Notifications
You must be signed in to change notification settings - Fork 126
176 lines (146 loc) · 4.95 KB
/
make-releases.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
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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
name: Make Releases
on:
workflow_dispatch:
jobs:
meta:
runs-on: ubuntu-latest
outputs:
tag: ${{steps.meta.outputs.tag}}
steps:
- name: Checkout Code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: GetMetadata
id: meta
working-directory: ngx-http-auth-jwt-module
run: |
set -eu
tag=$(git describe --tags --abbrev=0)
echo "tag=${tag}" >> $GITHUB_OUTPUT
build:
name: "NGINX: ${{ matrix.nginx-version }}; libjwt: ${{ matrix.libjwt-version }}"
needs: meta
strategy:
matrix:
# NGINX versions to build/test against
nginx-version: ['1.20.2'] #, '1.22.1', '1.24.0', '1.26.2', '1.27.3']
# The following versions of libjwt are compatible:
# * v1.0 - v1.12.0
# * v1.12.1 - v1.14.0
# * v1.15.0+
# At the time of writing this:
# * Debian and Ubuntu's repos have v1.10.2
# * EPEL has v1.12.1
# This compiles against each version prior to a breaking change and the latest release
libjwt-version: ['1.12.0'] #, '1.14.0', '1.15.3']
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v4
with:
path: ngx-http-auth-jwt-module
- name: Get Metadata
id: meta
run: |
set -eu
echo "filename=ngx-http-auth-jwt-module-${tag}_libjwt-${{matrix.libjwt-version}}_nginx-${{matrix.nginx-version}}.tgz" >> $GITHUB_OUTPUT
# TODO cache the build result so we don't have to do this every time?
- name: Download jansson
uses: actions/checkout@v4
with:
repository: 'akheron/jansson'
ref: 'v2.14'
path: 'jansson'
- name: Build jansson
working-directory: ./jansson
run: |
cmake . -DJANSSON_BUILD_SHARED_LIBS=1 -DJANSSON_BUILD_DOCS=OFF && \
make && \
make check && \
sudo make install
# TODO cache the build result so we don't have to do this every time?
- name: Download libjwt
uses: actions/checkout@v4
with:
repository: 'benmcollins/libjwt'
ref: 'v${{matrix.libjwt-version}}'
path: 'libjwt'
- name: Build libjwt
working-directory: ./libjwt
run: |
autoreconf -i && \
./configure && \
make all && \
sudo make install
- name: Download NGINX
run: |
mkdir nginx
curl -O http://nginx.org/download/nginx-${{matrix.nginx-version}}.tar.gz
tar -xzf nginx-${{matrix.nginx-version}}.tar.gz --strip-components 1 -C nginx
- name: Configure NGINX
working-directory: ./nginx
run: |
BUILD_FLAGS=''
MAJ=$(echo ${{matrix.nginx-version}} | cut -f1 -d.)
MIN=$(echo ${{matrix.nginx-version}} | cut -f2 -d.)
REV=$(echo ${{matrix.nginx-version}} | cut -f3 -d.)
if [ "${MAJ}" -gt 1 ] || [ "${MAJ}" -eq 1 -a "${MIN}" -ge 23 ]; then
BUILD_FLAGS="${BUILD_FLAGS} --with-cc-opt='-DNGX_LINKED_LIST_COOKIES=1'"
fi
./configure --with-compat --without-http_rewrite_module --add-dynamic-module=../ngx-http-auth-jwt-module ${BUILD_FLAGS}
- name: Make Modules
working-directory: ./nginx
run: make modules
- name: Create Release Archive
run: |
cp ./nginx/objs/ngx_http_auth_jwt_module.so ./
tar czf ${{steps.meta.outputs.filename}} ngx_http_auth_jwt_module.so
- name: Upload Build Artifact
uses: actions/upload-artifact@v4
with:
if-no-files-found: error
name: release
path: ${{steps.meta.outputs.filename}}
release:
name: Create/Update Release
needs:
- meta
- build
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Set-up Variables
id: vars
run: |
echo "date_now=$(date --rfc-3339=seconds)" >> "${GITHUB_OUTPUT}"
- name: Download Artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
- name: Flatten Artifacts
run: |
set -eu
cd artifacts
for f in $(find . -type f); do
echo "Staging: ${f}"
mv "${f}" .
done
find . -type d -mindepth 1 -exec rm -rf "{}" +
- name: Create/Update Release
uses: ncipollo/release-action@v1
with:
tag: ${{needs.meta.outputs.tag}}
name: "Pre-release: ${{ github.ref_name }}@${{ github.sha }}"
body: |
> [!WARNING]
> This is an automatically generated pre-release version of the module, which includes the latest master branch changes.
> Please report any bugs you find.
- Build Date: `${{ steps.vars.outputs.date_now }}`
- Commit: `${{ github.sha }}`
prerelease: true
allowUpdates: true
removeArtifacts: true
artifactErrorsFailBuild: true
artifacts: artifacts/*