-
Notifications
You must be signed in to change notification settings - Fork 0
110 lines (97 loc) · 3.54 KB
/
release.yml
File metadata and controls
110 lines (97 loc) · 3.54 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
name: Release
on:
push:
tags:
- 'v*'
workflow_dispatch:
inputs:
version:
description: 'Version to simulate (without v prefix)'
required: true
default: '1.0.0-test'
skip_publish:
description: 'Skip actual publishing of release'
type: boolean
default: true
jobs:
release:
name: Build and Release
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout Code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Get Version from Tag or Input
id: get_version
run: |
if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then
echo "VERSION=${{ github.event.inputs.version }}" >> $GITHUB_OUTPUT
echo "TESTING=true" >> $GITHUB_OUTPUT
else
echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT
echo "TESTING=false" >> $GITHUB_OUTPUT
fi
- name: Install System Dependencies
run: |
sudo apt-get update
sudo apt-get install -y z3 ruby ruby-dev rubygems build-essential
sudo gem install --no-document fpm
- name: Setup Haskell
uses: haskell-actions/setup@v2
with:
ghc-version: '9.6.3'
enable-stack: 'true'
stack-version: 'latest'
- name: Cache Stack
uses: actions/cache@v3
id: cache-stack
with:
path: |
~/.stack
./.stack-work
key: ${{ runner.os }}-stack-${{ hashFiles('stack.yaml', 'stack.yaml.lock', 'package.yaml') }}
restore-keys: |
${{ runner.os }}-stack-
- name: Install Dependencies
if: steps.cache-stack.outputs.cache-hit != 'true'
run: stack build --only-dependencies
- name: Create GitHub Release
id: create_release
if: github.event.inputs.skip_publish != 'true'
uses: softprops/action-gh-release@v1
with:
body_path: CHANGELOG.md
draft: false
prerelease: false
tag_name: v${{ steps.get_version.outputs.VERSION }}
- name: Build and Package
id: build_package
run: |
# Set optimal GHC options for the build
export STACK_BUILD_OPTS="--ghc-options=\"-O2 -j$(nproc) +RTS -N$(nproc) -A128m -n2m -qg -RTS\""
# Modify package.sh to use these options or pass them directly
chmod +x ./reposcripts/package.sh
PACKAGE_PATH=$(STACK_BUILD_OPTS="$STACK_BUILD_OPTS" ./reposcripts/package.sh | tail -n1)
echo "package_path=$PACKAGE_PATH" >> $GITHUB_OUTPUT
echo "Package path: $PACKAGE_PATH"
- name: Upload Release Asset
if: github.event.inputs.skip_publish != 'true'
uses: softprops/action-gh-release@v1
with:
files: ${{ steps.build_package.outputs.package_path }}
tag_name: v${{ steps.get_version.outputs.VERSION }}
- name: Output Results (Test Mode)
if: steps.get_version.outputs.TESTING == 'true'
run: |
echo "🧪 WORKFLOW TEST COMPLETED 🧪"
echo "✅ Build completed successfully"
echo "📦 Package created at: ${{ steps.build_package.outputs.package_path }}"
echo "🔖 Simulated version: v${{ steps.get_version.outputs.VERSION }}"
if [[ "${{ github.event.inputs.skip_publish }}" == "true" ]]; then
echo "⏭️ Publishing was skipped (test mode)"
else
echo "📢 Publishing was executed"
fi