-
Notifications
You must be signed in to change notification settings - Fork 10
109 lines (93 loc) · 3.04 KB
/
release.yml
File metadata and controls
109 lines (93 loc) · 3.04 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
name: Release
on:
push:
tags:
- 'v*'
workflow_dispatch:
inputs:
version:
description: 'Release version (e.g., v1.0.0)'
required: true
type: string
permissions:
contents: write
packages: write
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: false
jobs:
release:
name: Create Release
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Set up JDK 21
uses: actions/setup-java@v5
with:
java-version: 21
distribution: 'temurin'
cache: gradle
- name: Make gradlew executable
run: chmod +x gradlew
- name: Validate Gradle Wrapper
uses: gradle/actions/wrapper-validation@v5
- name: Run tests
run: ./gradlew test --no-daemon
env:
GRADLE_OPTS: -Xmx2g -Dorg.gradle.daemon=false
- name: Build release artifacts
run: ./gradlew assemble export --no-daemon
env:
GRADLE_OPTS: -Xmx2g -Dorg.gradle.daemon=false
- name: Generate changelog
id: changelog
run: |
# Generate changelog from git commits since last tag
PREVIOUS_TAG=$(git describe --tags --abbrev=0 HEAD^)
echo "## Changes" > CHANGELOG.md
git log --pretty=format:"* %s (%an)" ${PREVIOUS_TAG}..HEAD >> CHANGELOG.md
echo "" >> CHANGELOG.md
echo "## Build Information" >> CHANGELOG.md
echo "* Java Version: $(java -version 2>&1 | head -n 1)" >> CHANGELOG.md
echo "* Build Date: $(date -u '+%Y-%m-%d %H:%M:%S UTC')" >> CHANGELOG.md
echo "* Commit: ${{ github.sha }}" >> CHANGELOG.md
- name: Create release archives
run: |
# Create distribution archives
mkdir -p dist/
# Create source archive
git archive --format=tar.gz --prefix=goss-${{ github.ref_name }}/ HEAD > dist/goss-${{ github.ref_name }}-src.tar.gz
# Create binary archive with all JARs
tar -czf dist/goss-${{ github.ref_name }}-bin.tar.gz \
-C . \
--exclude='*.log' \
--exclude='generated/test-*' \
cnf/releaserepo/ \
*/generated/*.jar \
README.md \
pnnl.goss.core/LICENSE
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ github.ref_name }}
name: GOSS ${{ github.ref_name }}
body_path: CHANGELOG.md
draft: false
prerelease: ${{ contains(github.ref_name, 'rc') || contains(github.ref_name, 'beta') || contains(github.ref_name, 'alpha') }}
files: |
dist/*.tar.gz
cnf/releaserepo/**/*.jar
generate_release_notes: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Upload release artifacts
uses: actions/upload-artifact@v6
with:
name: release-artifacts-${{ github.ref_name }}
path: |
dist/
cnf/releaserepo/
retention-days: 90