Skip to content

Commit 99443d5

Browse files
authored
Add automated release workflow (#2)
* Add release workflow with manual testing capability This commit adds a comprehensive release workflow that can be tested before enabling automatic tag-based releases. Features: - Manual trigger via workflow_dispatch (for testing) - Reuses exact same build logic as CI workflow - Generates SHA256 checksums for all binaries - Creates versioned binary names (e.g., pocx_miner-v1.0.0-linux-x86_64) - Supports draft releases for verification - Auto-detects pre-releases (beta, rc, alpha) - Generates release notes automatically - Includes README.txt with installation instructions Testing Process: 1. Workflow disabled for tag pushes (commented out) 2. Can be triggered manually via Actions UI 3. Creates draft release for verification 4. Once verified, uncomment tag trigger to enable Binary Packages: - 32 total binaries (4 programs × 8 platforms) - SHA256SUMS.txt for verification - README.txt with installation guide Next Steps: 1. Test via workflow_dispatch 2. Verify draft release and artifacts 3. Enable tag-based releases 4. Create first beta/RC release Documentation: - RELEASE_TESTING.md: Complete testing guide - Includes versioning strategy - Manual upload instructions - Troubleshooting tips * Fix YAML syntax: Use unique heredoc delimiter * Force GitHub to re-validate workflow file * Trigger workflow discovery after cleanup * Add temporary push trigger for branch testing * Always create draft releases for manual verification - Remove draft toggle option from workflow_dispatch - Hardcode draft: true in release creation - Ensure all releases (manual or tag-based) are drafts - Manual publish step allows verification before going public * Add temporary push trigger to test release workflow from branch * Fix CI and release workflow issues - Remove obsolete ci-integration branch from CI triggers - Fix release workflow version extraction for branch pushes - Handle three trigger types: workflow_dispatch, tag push, branch push - Default to v0.0.1-test for branch push testing * Fix checksum generation for macOS - macOS uses shasum instead of sha256sum - Detect available command and use appropriate one - Fixes: sha256sum: command not found on macOS runners * Simplify release workflow with bundled archives - Bundle 4 binaries per platform into single archive (tar.gz/zip) - Reduces 32 individual files to 8 clean archives - Individual .sha256 checksum files (no master SHA256SUMS.txt) - Remove README.txt (redundant with release body) - Disable auto-generated release notes (no 'new contributors' noise) - Simplify release body text - Update documentation to reflect archive structure * Remove separate checksum files from releases - GitHub displays SHA256 automatically for each file - Removes redundant .sha256 files - Cleaner release with just 8 archives - Update documentation to reflect checksum handling * Enable production tag-based releases - Enable automatic releases when tags are pushed - Tag pattern: v1.0.0, v1.0.0-beta, v1.0.0-rc1, etc. - Keep workflow_dispatch for manual testing - Remove obvious checksum note from release body - Workflow creates draft releases for manual verification before publishing
1 parent 91cb3bc commit 99443d5

File tree

3 files changed

+454
-1
lines changed

3 files changed

+454
-1
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: CI
22

33
on:
44
push:
5-
branches: [ master, ci-integration ]
5+
branches: [ master ]
66
pull_request:
77
branches: [ master ]
88

.github/workflows/release.yml

Lines changed: 281 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,281 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v[0-9]+.[0-9]+.[0-9]+*' # v1.0.0, v1.0.0-beta, v1.0.0-rc1, etc.
7+
8+
workflow_dispatch:
9+
inputs:
10+
tag:
11+
description: 'Release tag (e.g., v1.0.0-beta)'
12+
required: true
13+
default: 'v0.0.1-test'
14+
15+
env:
16+
CARGO_TERM_COLOR: always
17+
18+
jobs:
19+
# Reuse the exact same build process from CI
20+
# No testing needed - master is already tested via PR workflow
21+
build:
22+
name: Build - ${{ matrix.target }}
23+
runs-on: ${{ matrix.os }}
24+
strategy:
25+
fail-fast: false
26+
matrix:
27+
include:
28+
# Linux x86_64
29+
- os: ubuntu-latest
30+
target: x86_64-unknown-linux-gnu
31+
cross: false
32+
features: simd
33+
opencl: false
34+
35+
# Linux x86_64 with OpenCL
36+
- os: ubuntu-latest
37+
target: x86_64-unknown-linux-gnu
38+
cross: false
39+
features: simd,opencl
40+
opencl: true
41+
42+
# Linux ARM64
43+
- os: ubuntu-latest
44+
target: aarch64-unknown-linux-gnu
45+
cross: true
46+
features: ""
47+
opencl: false
48+
49+
# Windows x86_64
50+
- os: windows-latest
51+
target: x86_64-pc-windows-msvc
52+
cross: false
53+
features: simd
54+
opencl: false
55+
56+
# macOS x86_64
57+
- os: macos-13
58+
target: x86_64-apple-darwin
59+
cross: false
60+
features: simd
61+
opencl: false
62+
63+
# macOS x86_64 with OpenCL
64+
- os: macos-13
65+
target: x86_64-apple-darwin
66+
cross: false
67+
features: simd,opencl
68+
opencl: true
69+
70+
# macOS ARM64 (Apple Silicon)
71+
- os: macos-14
72+
target: aarch64-apple-darwin
73+
cross: false
74+
features: ""
75+
opencl: false
76+
77+
# macOS ARM64 with OpenCL
78+
- os: macos-14
79+
target: aarch64-apple-darwin
80+
cross: false
81+
features: opencl
82+
opencl: true
83+
84+
steps:
85+
- uses: actions/checkout@v4
86+
87+
- name: Install Rust nightly
88+
uses: dtolnay/rust-toolchain@nightly
89+
with:
90+
targets: ${{ matrix.target }}
91+
92+
- name: Cache cargo registry
93+
uses: actions/cache@v4
94+
with:
95+
path: ~/.cargo/registry
96+
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
97+
98+
- name: Cache cargo index
99+
uses: actions/cache@v4
100+
with:
101+
path: ~/.cargo/git
102+
key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }}
103+
104+
- name: Cache target directory
105+
uses: actions/cache@v4
106+
with:
107+
path: target
108+
key: ${{ runner.os }}-${{ matrix.target }}-target-release-${{ hashFiles('**/Cargo.lock') }}
109+
110+
- name: Install cross-compilation tools
111+
if: matrix.cross
112+
run: |
113+
cargo install cross --git https://github.com/cross-rs/cross --locked || true
114+
115+
- name: Install OpenCL headers (Linux)
116+
if: matrix.opencl && runner.os == 'Linux'
117+
run: |
118+
sudo apt-get update
119+
sudo apt-get install -y ocl-icd-opencl-dev
120+
121+
- name: Build release binaries
122+
run: |
123+
FEATURES_FLAG=""
124+
if [ -n "${{ matrix.features }}" ]; then
125+
FEATURES_FLAG="--no-default-features --features ${{ matrix.features }}"
126+
else
127+
FEATURES_FLAG="--no-default-features"
128+
fi
129+
130+
if [ "${{ matrix.cross }}" = "true" ]; then
131+
cross build --release --target ${{ matrix.target }} \
132+
-p pocx_miner \
133+
-p pocx_plotter \
134+
-p pocx_verifier \
135+
-p pocx_mockchain \
136+
$FEATURES_FLAG
137+
else
138+
cargo build --release --target ${{ matrix.target }} \
139+
-p pocx_miner \
140+
-p pocx_plotter \
141+
-p pocx_verifier \
142+
-p pocx_mockchain \
143+
$FEATURES_FLAG
144+
fi
145+
shell: bash
146+
timeout-minutes: 60
147+
148+
- name: Prepare release artifacts (Unix)
149+
if: runner.os != 'Windows'
150+
run: |
151+
mkdir -p staging release-artifacts
152+
153+
# Get version from tag or input
154+
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
155+
VERSION="${{ github.event.inputs.tag }}"
156+
elif [[ "$GITHUB_REF" == refs/tags/* ]]; then
157+
VERSION="${GITHUB_REF#refs/tags/}"
158+
else
159+
VERSION="v0.0.1-test"
160+
fi
161+
162+
SUFFIX=""
163+
if [ "${{ matrix.opencl }}" = "true" ]; then
164+
SUFFIX="-opencl"
165+
fi
166+
167+
# Copy binaries to staging
168+
cp target/${{ matrix.target }}/release/pocx_miner staging/
169+
cp target/${{ matrix.target }}/release/pocx_plotter staging/
170+
cp target/${{ matrix.target }}/release/pocx_verifier staging/
171+
cp target/${{ matrix.target }}/release/pocx_mockchain staging/
172+
chmod +x staging/*
173+
174+
# Create archive
175+
ARCHIVE_NAME="pocx-${VERSION}-${{ matrix.target }}${SUFFIX}.tar.gz"
176+
tar -czf "release-artifacts/${ARCHIVE_NAME}" -C staging .
177+
shell: bash
178+
179+
- name: Prepare release artifacts (Windows)
180+
if: runner.os == 'Windows'
181+
run: |
182+
New-Item -ItemType Directory -Path staging, release-artifacts -Force
183+
184+
# Get version from tag or input
185+
if ("${{ github.event_name }}" -eq "workflow_dispatch") {
186+
$VERSION = "${{ github.event.inputs.tag }}"
187+
} elseif ($env:GITHUB_REF -like "refs/tags/*") {
188+
$VERSION = $env:GITHUB_REF -replace 'refs/tags/', ''
189+
} else {
190+
$VERSION = "v0.0.1-test"
191+
}
192+
193+
# Copy binaries to staging
194+
Copy-Item target/${{ matrix.target }}/release/pocx_miner.exe staging/
195+
Copy-Item target/${{ matrix.target }}/release/pocx_plotter.exe staging/
196+
Copy-Item target/${{ matrix.target }}/release/pocx_verifier.exe staging/
197+
Copy-Item target/${{ matrix.target }}/release/pocx_mockchain.exe staging/
198+
199+
# Create archive
200+
$ARCHIVE_NAME = "pocx-${VERSION}-${{ matrix.target }}.zip"
201+
Compress-Archive -Path staging/* -DestinationPath "release-artifacts/$ARCHIVE_NAME"
202+
shell: powershell
203+
204+
- name: Upload release artifacts
205+
uses: actions/upload-artifact@v4
206+
with:
207+
name: release-${{ matrix.target }}${{ matrix.opencl && '-opencl' || '' }}
208+
path: release-artifacts/*
209+
retention-days: 7
210+
211+
create-release:
212+
name: Create GitHub Release
213+
needs: build
214+
runs-on: ubuntu-latest
215+
permissions:
216+
contents: write
217+
steps:
218+
- uses: actions/checkout@v4
219+
with:
220+
fetch-depth: 0
221+
222+
- name: Download all artifacts
223+
uses: actions/download-artifact@v4
224+
with:
225+
path: all-artifacts
226+
227+
- name: Prepare release assets
228+
run: |
229+
mkdir -p release-assets
230+
find all-artifacts -type f -exec cp {} release-assets/ \;
231+
232+
cd release-assets
233+
ls -lh
234+
235+
- name: Get version
236+
id: version
237+
run: |
238+
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
239+
echo "tag=${{ github.event.inputs.tag }}" >> $GITHUB_OUTPUT
240+
elif [[ "$GITHUB_REF" == refs/tags/* ]]; then
241+
echo "tag=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
242+
else
243+
echo "tag=v0.0.1-test" >> $GITHUB_OUTPUT
244+
fi
245+
246+
- name: Create Release
247+
uses: softprops/action-gh-release@v1
248+
with:
249+
tag_name: ${{ steps.version.outputs.tag }}
250+
name: Release ${{ steps.version.outputs.tag }}
251+
draft: true # Always create as draft - publish manually after verification
252+
prerelease: ${{ contains(steps.version.outputs.tag, '-beta') || contains(steps.version.outputs.tag, '-rc') || contains(steps.version.outputs.tag, '-alpha') }}
253+
generate_release_notes: false
254+
files: |
255+
release-assets/*
256+
body: |
257+
## PoCX ${{ steps.version.outputs.tag }}
258+
259+
Pre-built binaries for all supported platforms.
260+
261+
**Platforms:**
262+
- Linux x86_64 / ARM64 (with/without OpenCL)
263+
- Windows x86_64
264+
- macOS x86_64 / ARM64 (with/without OpenCL)
265+
266+
**Binaries:**
267+
- `pocx_miner` - Mining client
268+
- `pocx_plotter` - Plot file generator
269+
- `pocx_verifier` - Plot verification tool
270+
- `pocx_mockchain` - Mock blockchain for testing
271+
272+
**Installation:**
273+
```bash
274+
# Linux/macOS
275+
tar -xzf pocx-*.tar.gz
276+
./pocx_miner --version
277+
278+
# Windows
279+
# Extract pocx-*.zip
280+
.\pocx_miner.exe --version
281+
```

0 commit comments

Comments
 (0)