-
-
Notifications
You must be signed in to change notification settings - Fork 1
186 lines (163 loc) · 5.51 KB
/
release.yml
File metadata and controls
186 lines (163 loc) · 5.51 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
name: Release Artifacts
on:
release:
types: [created]
workflow_dispatch:
inputs:
tag:
description: 'Release tag to build for (e.g., 1.4.0)'
required: true
jobs:
# Build native riddlc binaries on each target platform
native-build:
timeout-minutes: 60
permissions:
contents: write
packages: read
strategy:
fail-fast: false
matrix:
include:
- os: macos-latest
artifact: riddlc-macos-arm64
arch: arm64
- os: ubuntu-latest
artifact: riddlc-linux-x86_64
arch: x86_64
runs-on: ${{ matrix.os }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: Checkout Code
uses: actions/checkout@v4
with:
ref: ${{ github.event.release.tag_name || github.event.inputs.tag }}
- name: Set Up JDK 25
uses: actions/setup-java@v4
with:
java-version: '25'
distribution: temurin
cache: sbt
- name: Set Up SBT
uses: sbt/setup-sbt@7e33f738678e47369c83dcb4b1d9c65d66eb3cdd # v1
- name: Coursier Caching
uses: coursier/cache-action@2addd381bd2c931f42d4b734b9d0c9b73aac16fb # v6
- name: Configure sbt GitHub Packages credentials
run: |
mkdir -p ~/.sbt/1.0
cat > ~/.sbt/1.0/github.sbt << 'CREDSEOF'
credentials += Credentials(
"GitHub Package Registry",
"maven.pkg.github.com",
"x-access-token",
sys.env.getOrElse("GITHUB_TOKEN", "")
)
CREDSEOF
- name: Install LLVM and Clang (Linux only)
if: runner.os == 'Linux'
run: |
sudo apt-get update && sudo apt-get install -y clang llvm
- name: Install curl dev dependencies (Linux only)
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install -y libcurl4-openssl-dev libidn2-dev
- name: Build Native Binary
run: sbt riddlcNative/nativeLink
- name: Package Native Binary
run: |
mkdir -p staging/bin
cp riddlc/native/target/scala-3.7.4/riddlc staging/bin/riddlc
cd staging && zip -r ../${{ matrix.artifact }}.zip bin/
- name: Upload to Release
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
TAG="${{ github.event.release.tag_name || github.event.inputs.tag }}"
gh release upload "$TAG" "${{ matrix.artifact }}.zip" --clobber
- name: Upload Build Artifact
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.artifact }}
retention-days: 30
path: ${{ matrix.artifact }}.zip
# Build JVM version (universal, runs on any platform with JDK)
jvm-build:
timeout-minutes: 60
permissions:
contents: write
packages: read
runs-on: ubuntu-latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: Checkout Code
uses: actions/checkout@v4
with:
ref: ${{ github.event.release.tag_name || github.event.inputs.tag }}
- name: Set Up JDK 25
uses: actions/setup-java@v4
with:
java-version: '25'
distribution: temurin
cache: sbt
- name: Set Up SBT
uses: sbt/setup-sbt@7e33f738678e47369c83dcb4b1d9c65d66eb3cdd # v1
- name: Coursier Caching
uses: coursier/cache-action@2addd381bd2c931f42d4b734b9d0c9b73aac16fb # v6
- name: Configure sbt GitHub Packages credentials
run: |
mkdir -p ~/.sbt/1.0
cat > ~/.sbt/1.0/github.sbt << 'CREDSEOF'
credentials += Credentials(
"GitHub Package Registry",
"maven.pkg.github.com",
"x-access-token",
sys.env.getOrElse("GITHUB_TOKEN", "")
)
CREDSEOF
- name: Build and Stage JVM Version
run: |
sbt riddlc/stage
cd riddlc/jvm/target/universal/stage && zip -r ../../../../../riddlc.zip bin/ lib/
- name: Upload to Release
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
TAG="${{ github.event.release.tag_name || github.event.inputs.tag }}"
gh release upload "$TAG" riddlc.zip --clobber
- name: Upload Build Artifact
uses: actions/upload-artifact@v4
with:
name: riddlc-jvm
retention-days: 30
path: riddlc.zip
# Notify homebrew-tap to update formula with new SHA256 hashes
update-homebrew:
needs: [native-build, jvm-build]
timeout-minutes: 10
runs-on: ubuntu-latest
steps:
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
- name: Compute SHA256 hashes
id: hashes
run: |
echo "macos_arm64=$(shasum -a 256 artifacts/riddlc-macos-arm64/riddlc-macos-arm64.zip | cut -d' ' -f1)" >> "$GITHUB_OUTPUT"
echo "linux_x86=$(shasum -a 256 artifacts/riddlc-linux-x86_64/riddlc-linux-x86_64.zip | cut -d' ' -f1)" >> "$GITHUB_OUTPUT"
echo "jvm=$(shasum -a 256 artifacts/riddlc-jvm/riddlc.zip | cut -d' ' -f1)" >> "$GITHUB_OUTPUT"
- name: Dispatch formula update to homebrew-tap
uses: peter-evans/repository-dispatch@v3
with:
token: ${{ secrets.HOMEBREW_TAP_SECRET }}
repository: ossuminc/homebrew-tap
event-type: update-formula
client-payload: >-
{
"version": "${{ github.event.release.tag_name || github.event.inputs.tag }}",
"sha_macos_arm64": "${{ steps.hashes.outputs.macos_arm64 }}",
"sha_linux_x86": "${{ steps.hashes.outputs.linux_x86 }}",
"sha_jvm": "${{ steps.hashes.outputs.jvm }}"
}