-
Notifications
You must be signed in to change notification settings - Fork 18
144 lines (121 loc) · 3.88 KB
/
build.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
name: CD
on:
push:
branches:
- '*'
tags:
- 'v*.*.*' # Enforce Semantic Versioning
jobs:
get_modules:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: List Java modules
id: echo-modules
run: echo "modules=$(cat .java_modules)" >> $GITHUB_OUTPUT
outputs:
modules: ${{ steps.echo-modules.outputs.modules }}
build_jre:
needs: get_modules
uses: yetanalytics/workflow-runtimer/.github/workflows/runtimer.yml@v2
with:
java-version: '11'
java-distribution: 'temurin'
java-modules: ${{ needs.get_modules.outputs.modules }}
build:
runs-on: ubuntu-latest
needs: build_jre
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup CI Environment
uses: yetanalytics/action-setup-env@v2
# BUILD WITHOUT RUNTIME
- name: Build Bundle
run: make bundle BUNDLE_RUNTIMES=false
# GET RUNTIMES FROM ARTIFACTS
- name: Download ubuntu-latest Artifact
uses: actions/download-artifact@v4
with:
name: ubuntu-22.04-jre
- name: Download macOS-latest Artifact
uses: actions/download-artifact@v4
with:
name: macos-14-jre
- name: Download windows-latest Artifact
uses: actions/download-artifact@v4
with:
name: windows-2022-jre
# UNZIP RUNTIMES INTO OS-SPECIFIC RUNTIME DIRS
- name: Unzip the runtimes
run: |
mkdir -p target/bundle/runtimes
unzip ubuntu-22.04-jre.zip -d target/bundle/runtimes
mv target/bundle/runtimes/ubuntu-22.04 target/bundle/runtimes/linux
unzip macos-14-jre.zip -d target/bundle/runtimes
mv target/bundle/runtimes/macos-14 target/bundle/runtimes/macos
unzip windows-2022-jre.zip -d target/bundle/runtimes
mv target/bundle/runtimes/windows-2022 target/bundle/runtimes/windows
# ARCHIVE BUNDLE - LABEL WITH COMMIT SHA OR TAG NAME
- name: Compress Bundle
run: | # Need to cd so that the zip file doesn't contain the parent dirs
cd target/bundle
zip -r ../../lrsql.zip ./
- name: Archive Bundle (Branch Pushes)
if: ${{ github.ref_type == 'branch' }}
uses: actions/upload-artifact@v4
with:
name: lrsql-artifact-${{ github.sha }}
path: lrsql.zip
- name: Archive Bundle (Tag Pushes)
if: ${{ github.ref_type == 'tag' }}
uses: actions/upload-artifact@v4
with:
name: lrsql-artifact-${{ github.ref_name }}
path: lrsql.zip
release:
runs-on: ubuntu-latest
needs: build
if: ${{ github.ref_type == 'tag' }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Download Bundle Artifact
uses: actions/download-artifact@v4
with:
name: lrsql-artifact-${{ github.ref_name }}
- name: Unzip Bundle Artifact
run: |
mkdir -p target/bundle
unzip lrsql.zip -d target/bundle
- name: Craft Draft Release
uses: softprops/action-gh-release@v2
with:
# Defaults:
# name: [tag name]
# tag_name: github.ref
body: "## Release Notes\nTODO: Create great release notes!"
draft: true
files: lrsql.zip
- name: Deploy Documentation
uses: JamesIves/github-pages-deploy-action@v4.6.4
with:
branch: gh-pages
folder: target/bundle/doc
- name: Log in to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: yetanalytics/lrsql
- name: Build and push Docker image
uses: docker/build-push-action@v6
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}