Skip to content

Commit c294a67

Browse files
committed
GitHub action to build/test/publish Linux/Mac binaries.
1 parent 41efb72 commit c294a67

1 file changed

Lines changed: 118 additions & 0 deletions

File tree

.github/workflows/release.yml

Lines changed: 118 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
name: Build/publish release binaries (Linux, Mac)
2+
3+
on:
4+
push:
5+
# Trigger on version tags: v4.10 etc.
6+
# tags:
7+
# - 'v*'
8+
# Allows manual triggering
9+
workflow_dispatch:
10+
inputs:
11+
tag_name:
12+
description: 'Target tag (e.g., v4.10)'
13+
required: true
14+
type: string
15+
do_publish:
16+
description: 'Upload to the GitHub release?'
17+
required: true
18+
type: boolean
19+
default: false
20+
21+
jobs:
22+
23+
build:
24+
strategy:
25+
matrix:
26+
include:
27+
- os: ubuntu-latest
28+
artifact_name: prism-linux64
29+
- os: macos-latest
30+
artifact_name: prism-macos64
31+
runs-on: ${{ matrix.os }}
32+
33+
steps:
34+
- uses: actions/checkout@v4
35+
- name: Set up JDK
36+
uses: actions/setup-java@v4
37+
with:
38+
java-version: '17'
39+
distribution: 'temurin'
40+
- name: Build
41+
shell: bash
42+
working-directory: ./prism
43+
run: |
44+
make release
45+
- name: Upload artifact
46+
uses: actions/upload-artifact@v4
47+
with:
48+
name: ${{ matrix.artifact_name }}
49+
path: prism/release/*.tar.gz
50+
51+
test_release:
52+
needs: build
53+
strategy:
54+
matrix:
55+
include:
56+
- os: ubuntu-latest
57+
artifact: prism-linux64
58+
- os: macos-latest
59+
artifact: prism-macos64
60+
runs-on: ${{ matrix.os }}
61+
62+
steps:
63+
- name: Download Artifact
64+
uses: actions/download-artifact@v4
65+
with:
66+
name: ${{ matrix.artifact }}
67+
path: test-dir
68+
- name: Verify download
69+
run: ls -R test-dir/
70+
- name: Build and run smoke test
71+
shell: bash
72+
working-directory: ./test-dir
73+
run: |
74+
tar -xzf prism*.tar.gz
75+
rm prism*.tar.gz
76+
cd prism-*
77+
./install.sh
78+
etc/tests/run.sh
79+
80+
publish:
81+
needs: [build, test_release]
82+
runs-on: ubuntu-latest
83+
permissions:
84+
# Crucial for creating releases
85+
contents: write
86+
if: startsWith(github.ref, 'refs/tags/') || github.event.inputs.do_publish == 'true'
87+
88+
steps:
89+
- name: Download all artifacts
90+
uses: actions/download-artifact@v4
91+
with:
92+
# This downloads all job artifacts into subfolders
93+
path: ./artifacts
94+
95+
- name: Organize files and Generate Checksums
96+
# Move files from subfolders into one flat directory for the release
97+
shell: bash
98+
run: |
99+
mkdir -p release-assets
100+
find ./artifacts -type f \( -name "*.tar.gz" -o -name "*.exe" -o -name "*.zip" \) -exec cp {} ./release-assets/ \;
101+
cd release-assets
102+
sha256sum * > checksums.txt
103+
echo "Assets to be published:"
104+
ls -lh
105+
106+
- name: Create or update GitHub release
107+
uses: softprops/action-gh-release@v2
108+
with:
109+
# Use the tag from manual input, otherwise fall back to the git ref
110+
tag_name: ${{ github.event.inputs.tag_name || github.ref_name }}
111+
# Upload files (omit checksums for now)
112+
files: |
113+
release-assets/*.tar.gz
114+
release-assets/*.exe
115+
release-assets/*.zip
116+
# These are safe even if the release exists; it won't overwrite your text
117+
generate_release_notes: false
118+
draft: false

0 commit comments

Comments
 (0)