-
Notifications
You must be signed in to change notification settings - Fork 0
110 lines (95 loc) · 3.32 KB
/
Copy pathrelease.yml
File metadata and controls
110 lines (95 loc) · 3.32 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*'
permissions:
contents: write
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: false
jobs:
release:
name: release (Sonatype Central Portal)
runs-on: ubuntu-latest
env:
HOMEBREW_TAP_TOKEN: ${{ secrets.HOMEBREW_TAP_TOKEN }}
steps:
- uses: actions/checkout@v7
- name: Set up JDK 25
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: '25'
cache: maven
cache-dependency-path: java/pom.xml
server-id: central
server-username: MAVEN_USERNAME
server-password: MAVEN_PASSWORD
gpg-private-key: ${{ secrets.OSSRH_GPG_PRIVATE_KEY }}
gpg-passphrase: MAVEN_GPG_PASSPHRASE
- name: Verify release commit
working-directory: java
run: mvn -B -ntp spotless:check checkstyle:check verify -P recorded
- name: Package CLI release artifacts
run: scripts/package-cli-release.sh --version "${GITHUB_REF_NAME#v}"
- name: Smoke CLI release tarball
run: scripts/smoke-cli-release.sh --version "${GITHUB_REF_NAME#v}"
- name: Generate CycloneDX SBOM
working-directory: java
run: |
mvn -B -ntp -DskipTests cyclonedx:makeAggregateBom
cp target/bom.json ../dist/doctruth-${GITHUB_REF_NAME#v}-sbom.cdx.json
- name: Deploy to Sonatype Central Portal
working-directory: java
run: mvn -B -ntp -P release deploy -DskipTests
env:
MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.MAVEN_PASSWORD }}
MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }}
- name: Upload release artefacts
if: always()
uses: actions/upload-artifact@v7
with:
name: release-artefacts
path: |
dist/*
dist/homebrew/*
java/target/*.jar
java/target/*.jar.asc
java/target/*.pom
retention-days: 30
- name: Create GitHub Release
uses: softprops/action-gh-release@v3
with:
files: |
dist/doctruth-*.tar.gz
dist/doctruth-java-*-all.jar
dist/doctruth-*-sbom.cdx.json
dist/checksums.txt
dist/homebrew/doctruth.rb
generate_release_notes: true
- name: Update Homebrew tap
if: ${{ env.HOMEBREW_TAP_TOKEN != '' }}
env:
RELEASE_VERSION: ${{ github.ref_name }}
run: |
version="${RELEASE_VERSION#v}"
git config --global user.name "doctruth-release-bot"
git config --global user.email "release-bot@doctruth.ai"
git clone "https://x-access-token:${HOMEBREW_TAP_TOKEN}@github.com/doctruthhq/homebrew-tap.git" tap
mkdir -p tap/Formula
cp dist/homebrew/doctruth.rb tap/Formula/doctruth.rb
cd tap
git add Formula/doctruth.rb
git commit -m "doctruth ${version}" || exit 0
git push origin HEAD:main
- name: Upload surefire reports on failure
if: failure()
uses: actions/upload-artifact@v7
with:
name: release-surefire
path: |
**/target/surefire-reports
**/target/failsafe-reports
retention-days: 7