-
Notifications
You must be signed in to change notification settings - Fork 1
119 lines (98 loc) · 3.4 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
name: 🏗️ Build
on:
pull_request:
merge_group:
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
IMAGE_NAME: vcspeaker.kt
jobs:
bump-version:
name: 🔼 Bump version
runs-on: ubuntu-latest
outputs:
version: ${{ steps.version.outputs.new_version }}
tag: ${{ steps.version.outputs.new_tag }}
changelog: ${{ steps.version.outputs.changelog }}
steps:
- name: 🔼 Bump release version
id: version
uses: mathieudutour/github-tag-action@v6.2
with:
github_token: ${{ github.token }}
default_bump: "minor"
custom_release_rules: "breaking:major:💣 Breaking Changes,feat:minor:✨ Features,fix:patch:💣 Bug Fixes,docs:patch:📰 Docs,chore:patch:🎨 Chore,pref:patch:🎈 Performance improvements,refactor:patch:🧹 Refactoring,build:patch:🔍 Build,ci:patch:🔍 CI,revert:patch:⏪ Revert,style:patch:🧹 Style,test:patch:👀 Test"
dry_run: true
build-docker:
name: 🏗️ Build Docker (${{ matrix.architecture }})
runs-on: ubuntu-latest
needs: bump-version
strategy:
fail-fast: false
matrix:
architecture: [ amd64, arm64 ]
steps:
- name: 📥 Checkout ${{ github.repository }}
uses: actions/checkout@v4
- name: 🐋 Setup QEMU
uses: docker/setup-qemu-action@v3
- name: 🏗️ Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: 📥 Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: 📝 Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5.6.1
with:
images: ghcr.io/${{ github.repository_owner }}/${{ env.IMAGE_NAME }}
tags: |
type=raw,value=${{ needs.bump-version.outputs.version }}-${{ matrix.architecture }}
type=raw,value=latest-${{ matrix.architecture }}
- name: 🚀 Build Docker image
id: build
uses: docker/build-push-action@v6
with:
context: .
file: ./Dockerfile
push: false
platforms: linux/${{ matrix.architecture }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
provenance: false
build-jar:
name: 📦 Build Jar
runs-on: ubuntu-latest
steps:
- name: ☕ Setup Zulu JDK 21
uses: actions/setup-java@v4.5.0
with:
distribution: zulu
java-version: 21
- name: 🐘 Setup Gradle
uses: gradle/actions/setup-gradle@v4
with:
gradle-version: release-candidate
- name: 📥 Checkout ${{ github.repository }}
uses: actions/checkout@v4
- name: ⌛ Restore caches
uses: actions/cache@v4
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: 🐘 Run Gradle command
run: |
gradle build
- name: 📦 Upload the artifact
uses: actions/upload-artifact@v4
with:
name: VCSpeaker.kt Shadow Jar
path: build/libs/vcspeaker-kt-all.jar
overwrite: true