forked from mageddo/dns-proxy-server
-
Notifications
You must be signed in to change notification settings - Fork 0
222 lines (189 loc) · 6.92 KB
/
actions-deploy.yml
File metadata and controls
222 lines (189 loc) · 6.92 KB
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
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
name: CD
on:
push:
branches:
- master
permissions:
contents: write
env:
CURRENT_BRANCH: ${{ github.head_ref || github.ref_name }}
# github token to deploy the binary
REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
jobs:
primary_release:
runs-on: ubuntu-22.04
outputs:
APP_VERSION: ${{ steps.set_app_version.outputs.APP_VERSION }}
steps:
- name: Explain
run: |
echo "Releases the Jar and Linux AMD64 version"
- name: Install Deps
run: sudo apt-get install docker-compose -y
- name: Checkout code
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set app version
id: set_app_version
run: ./gradlew setVersionOnActions
- name: Check already released
run: git rev-parse "${APP_VERSION}^{}" >/dev/null 2>&1 && echo "> Already released" && exit 3 || echo "Not released yet"
- name: Jar and Linux AMD64 Release
run: |
mkdir -p ./build/ \
&& docker-compose -f docker-compose-deploy.yml up --build --force-recreate --exit-code-from deploy deploy \
&& ls -lhS ./build/*
- name: Upload Artifacts
uses: actions/upload-artifact@v4
with:
name: native-image-source
path: ./build/artifacts/native-image-source/dns-proxy-server.jar
- name: Latest version changelog extraction
uses: kemayo/actions-recent-changelog@v1
with:
input: RELEASE-NOTES.md
output: VERSION-RELEASE-NOTES.md
- name: Check Release Notes
run: cat ./VERSION-RELEASE-NOTES.md
- name: Github release
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ env.APP_VERSION }}
prerelease: true
body_path: VERSION-RELEASE-NOTES.md
files: |
./build/compressed-artifacts/*
linux_amd64_static_release:
runs-on: ubuntu-22.04
needs: primary_release
env:
APP_VERSION: ${{ needs.primary_release.outputs.APP_VERSION }}
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Check app version
run: echo "$APP_VERSION"
- name: Install Deps
run: sudo apt-get install rename docker-compose -y
- uses: actions/download-artifact@v4
with:
name: native-image-source
path: ./build/artifacts/native-image-source/
- name: Linux Amd64 static Release
run: |
echo "app version=$APP_VERSION" &&\
tree -h ./build/ &&\
docker-compose -f docker-compose-deploy.yml run deploy bash -c '
/bin/builder.bash deploy-amd64-static &&\
echo "> Copying files to the host" &&\
cp -rv /app/build/compressed-artifacts /host/build/ &&\
echo "Linux amd64 static is done!"
' &&\
tree -h ./build/
# Release details will be provided by primary-release
- name: Github release
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ env.APP_VERSION }}
append_body: true
body: ''
files: |
./build/compressed-artifacts/*
linux_arm_release:
runs-on: ubuntu-22.04
needs: primary_release
env:
APP_VERSION: ${{ needs.primary_release.outputs.APP_VERSION }}
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Check app version
run: echo "$APP_VERSION"
- name: Install Deps
run: sudo apt-get install rename docker-compose -y
- uses: actions/download-artifact@v4
with:
name: native-image-source
path: ./build/artifacts/native-image-source/
- name: Latest Qemu binaries (8.2x)
run: |
docker-compose -f docker-compose-qemu.yaml build --progress=plain
- name: Configure Qemu With Docker
run: docker run --rm --privileged defreitas/qemu-user-static --reset -p yes
- name: Linux Arm Release
run: |
echo "app version=$APP_VERSION" &&\
tree -h ./build/ &&\
docker-compose -f docker-compose-deploy.yml run deploy bash -c '
/bin/builder.bash deploy-arm &&\
echo "> Copying files to the host" &&\
cp -rv /app/build/compressed-artifacts /host/build/ &&\
echo "Linux arm64 is done!"
' &&\
tree -h ./build/
# Release details will be provided by primary-release
- name: Github release
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ env.APP_VERSION }}
append_body: true
body: ''
files: |
./build/compressed-artifacts/*
aditional_release:
name: ${{ matrix.os }} release
needs: primary_release
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [windows-latest]
# disabling mac as the binary isn't working macos-latest, see #341
env:
APP_VERSION: ${{ needs.primary_release.outputs.APP_VERSION }}
steps:
- name: Checkout code
uses: actions/checkout@v3
- uses: actions/download-artifact@v4
with:
name: native-image-source
path: ./build/artifacts/native-image-source/
- uses: graalvm/setup-graalvm@v1
with:
java-version: '21'
components: 'native-image'
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Os Report ${{ matrix.os }}
run: |
echo "> Building binary for: ${RUNNER_OS}-${RUNNER_ARCH}" &&\
mkdir tmp &&\
mkdir -p ./build/artifacts/${RUNNER_OS}-${RUNNER_ARCH} ./build/compressed-artifacts/${RUNNER_OS}-${RUNNER_ARCH}
shell: bash
- name: build native-image binary ${{ matrix.os }}
if: runner.os == 'Windows'
run: |
${GRAALVM_HOME}/bin/native-image.cmd \
-H:+AddAllCharsets \
-H:ServiceLoaderFeatureExcludeServices=java.net.ContentHandlerFactory \
-jar ./build/artifacts/native-image-source/dns-proxy-server.jar ./tmp/dns-proxy-server
shell: bash
- name: build native-image binary ${{ matrix.os }}
if: runner.os == 'macOS'
run: native-image -jar ./build/artifacts/native-image-source/dns-proxy-server.jar ./tmp/dns-proxy-server
- name: build native-image binary ${{ matrix.os }}
run: |
ls -lhS ./tmp &&\
mv ./tmp/* ./build/artifacts/${RUNNER_OS}-${RUNNER_ARCH}/ &&\
7z a -tzip ./build/compressed-artifacts/dns-proxy-server-${RUNNER_OS}-${RUNNER_ARCH}-${APP_VERSION}.zip ./build/artifacts/${RUNNER_OS}-${RUNNER_ARCH}
shell: bash
# Release details will be provided by primary-release
- name: Github release
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ env.APP_VERSION }}
append_body: true
body: ''
files: |
./build/compressed-artifacts/*