-
Notifications
You must be signed in to change notification settings - Fork 73
160 lines (143 loc) · 5.76 KB
/
build-binaries.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
name: GraalVM Native Image builds on All platforms
on:
workflow_dispatch:
inputs:
releaseversion:
description: 'Release version'
required: true
default: 'X.X.X'
jobs:
release:
name: Creating Release for CATS ${{ github.event.inputs.releaseversion }}
runs-on: ubuntu-latest
outputs:
release_upload_url: ${{ steps.create_release.outputs.upload_url }}
steps:
- name: Checkout Code
uses: actions/checkout@v4
with:
fetch-tags: true
ref: cats-${{ github.event.inputs.releaseversion }}
- name: Get Previous Tag
id: get_previous_tag
run: echo "PREVIOUS_TAG=$(git describe --tags --abbrev=0 HEAD^)" >> $GITHUB_ENV
- name: Generate Changelog
id: generate_changelog
run: |
CHANGELOG=$(git log ${{ env.PREVIOUS_TAG }}..${{ github.ref_name }} --pretty=format:"* %s" --no-merges | grep -vE "\[maven-release-plugin\]|chore:|docs:|test:|ci:|build:")
echo "CHANGELOG<<EOF" >> $GITHUB_ENV
echo "$CHANGELOG" >> $GITHUB_ENV
echo "EOF" >> $GITHUB_ENV
- name: Create GitHub Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: cats-${{ github.event.inputs.releaseversion }}
release_name: cats-${{ github.event.inputs.releaseversion }}
draft: false
prerelease: false
body: ${{ env.CHANGELOG}}
build_uberjar:
name: Building CATS uberjar for release ${{ github.event.inputs.releaseversion }}
needs: release
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v4
with:
ref: cats-${{ github.event.inputs.releaseversion }}
- name: Build Uberjar
run: |
./mvnw -B clean --file pom.xml
./mvnw -B package --file pom.xml -Dquarkus.package.type=uber-jar -DskipTests=true
- name: Tar jar file
run: |
cp target/cats-runner.jar cats.jar
tar -czf cats_uberjar_${{ github.event.inputs.releaseversion }}.tar.gz cats.jar
- name: Upload Uberjar
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
RELEASE_URL: ${{ needs.release.outputs.release_upload_url }}
with:
upload_url: ${{ env.RELEASE_URL }}
asset_path: cats_uberjar_${{ github.event.inputs.releaseversion }}.tar.gz
asset_name: cats_uberjar_${{ github.event.inputs.releaseversion }}.tar.gz
asset_content_type: application/gzip
build:
name: Building CATS on ${{ matrix.os }} for release ${{ github.event.inputs.releaseversion }}
needs: release
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ macos-latest, macos-13, windows-latest, ubuntu-latest ]
steps:
- name: Checkout Code
uses: actions/checkout@v4
with:
ref: cats-${{ github.event.inputs.releaseversion }}
- name: Setup GraalVM
uses: graalvm/setup-graalvm@v1
with:
java-version: '21'
distribution: 'graalvm'
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Determine OS Architecture for Linux and MacOS
if: matrix.os != 'windows-latest'
id: determine_arch
run: |
arch=$(uname -p)
if [[ "$arch" == "arm" ]]; then
echo "OS_ARCH=arm64" >> $GITHUB_ENV
else
echo "OS_ARCH=amd64" >> $GITHUB_ENV
fi
- name: Determine OS Architecture for Windows
if: matrix.os == 'windows-latest'
id: determine_arch_windows
run: |
echo "OS_ARCH=amd64" >> $GITHUB_ENV
- name: Determine OS Name
id: determine_os
run: echo "RUNNER_OS=${{ matrix.os }}" | sed 's/-[^-]*$//' >> $GITHUB_ENV
- name: Build and run CATS
run: |
./mvnw -B clean --file pom.xml
./mvnw -B package --file pom.xml -Pnative -DskipTests=true
- name: Tar files for Linux and MacOS
if: matrix.os != 'windows-latestt'
run: |
cp target/cats-runner cats
tar -czf cats_${{ env.RUNNER_OS }}_${{ env.OS_ARCH}}_${{ github.event.inputs.releaseversion }}.tar.gz cats
- name: Upload Tar files for Linux and MacOS
if: matrix.os != 'windows-latestt'
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
RELEASE_URL: ${{ needs.release.outputs.release_upload_url }}
with:
upload_url: ${{ env.RELEASE_URL }}
asset_path: cats_${{ env.RUNNER_OS }}_${{ env.OS_ARCH}}_${{ github.event.inputs.releaseversion }}.tar.gz
asset_name: cats_${{ env.RUNNER_OS }}_${{ env.OS_ARCH}}_${{ github.event.inputs.releaseversion }}.tar.gz
asset_content_type: application/gzip
- name: Zip file for Windows
if: matrix.os == 'windows-latest'
run: |
copy target\cats-native-image-source-jar\cats-runner.exe cats.exe
Compress-Archive -Path cats.exe -Destination cats_windows_amd64_${{ github.event.inputs.releaseversion }}.zip
- name: Upload Zip for Windows
if: matrix.os == 'windows-latest'
id: upload-release-asset-windows
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
RELEASE_URL: ${{ needs.release.outputs.release_upload_url }}
with:
upload_url: ${{ env.RELEASE_URL }}
asset_path: cats_windows_amd64_${{ github.event.inputs.releaseversion }}.zip
asset_name: cats_windows_amd64_${{ github.event.inputs.releaseversion }}.zip
asset_content_type: application/zip