Skip to content

Commit 1bb8bdb

Browse files
committed
Release build workflow
1 parent f5befe4 commit 1bb8bdb

3 files changed

Lines changed: 202 additions & 4 deletions

File tree

.github/workflows/make-tests.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@ name: Regression tests
33
on:
44
push:
55
branches: [ master ]
6-
pull_request:
7-
branches: [ master ]
6+
# pull_request:
7+
# branches: [ master ]
88

99
jobs:
10-
build:
1110

11+
build:
1212
strategy:
1313
matrix:
1414
java: [11, 21]
@@ -23,14 +23,14 @@ jobs:
2323
java-version: ${{ matrix.java }}
2424
distribution: temurin
2525
- name: make tests
26+
shell: bash
2627
working-directory: ./prism
2728
run: |
2829
make
2930
make unittests
3031
make tests
3132
3233
build-win:
33-
3434
strategy:
3535
matrix:
3636
java: [11, 21]

.github/workflows/release-win.yml

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
# Trigger on version tags: v4.10 etc.
6+
tags:
7+
- 'v*'
8+
# TEMP
9+
# pull_request:
10+
# branches: [ master ]
11+
# Allows manual triggering
12+
workflow_dispatch:
13+
inputs:
14+
do_publish:
15+
description: 'Actually publish to GitHub Releases?'
16+
required: true
17+
type: boolean
18+
default: false
19+
20+
jobs:
21+
22+
build:
23+
strategy:
24+
matrix:
25+
include:
26+
- os: windows-latest
27+
artifact_name: prism-win64
28+
runs-on: ${{ matrix.os }}
29+
30+
steps:
31+
- run: git config --global core.autocrlf input
32+
- uses: actions/checkout@v4
33+
- name: Set up JDK
34+
uses: actions/setup-java@v4
35+
with:
36+
java-version: '17'
37+
distribution: 'temurin'
38+
- name: Install Cygwin Dependencies
39+
uses: cygwin/cygwin-install-action@v4
40+
with:
41+
packages: |
42+
make,
43+
mingw64-x86_64-gcc-g++,
44+
binutils,
45+
dos2unix,
46+
wget,
47+
unzip,
48+
python
49+
- name: Install NSIS
50+
uses: negrutiu/nsis-install@v2
51+
- name: Build
52+
shell: bash
53+
env:
54+
CYGWIN: winsymlinks:native
55+
working-directory: ./prism
56+
# echo "C:\Program Files (x86)\NSIS" >> $GITHUB_PATH &&
57+
# echo "C:/Program Files (x86)/NSIS" >> $GITHUB_PATH &&
58+
# echo $GITHUB_PATH &&
59+
# make release
60+
run: >-
61+
make release
62+
- name: Upload artifact
63+
uses: actions/upload-artifact@v4
64+
with:
65+
name: ${{ matrix.artifact_name }}
66+
path: prism/release/*.exe
67+

.github/workflows/release.yml

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

0 commit comments

Comments
 (0)