-
Notifications
You must be signed in to change notification settings - Fork 0
137 lines (116 loc) · 4.47 KB
/
Copy pathrelease.yml
File metadata and controls
137 lines (116 loc) · 4.47 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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
name: Release
on:
push:
branches:
- main
tags:
- "v*"
workflow_dispatch:
inputs:
tag_name:
description: "Existing tag to build and release, for example v0.7.0"
required: true
type: string
permissions:
contents: write
concurrency:
group: release-${{ github.event_name == 'workflow_dispatch' && inputs.tag_name || github.ref_name }}
cancel-in-progress: false
jobs:
build-release:
name: Build Windows release
runs-on: windows-latest
if: github.event_name != 'push' || startsWith(github.ref, 'refs/tags/v') || startsWith(github.event.head_commit.message, 'Release v')
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ github.event_name == 'workflow_dispatch' && inputs.tag_name || github.ref }}
- name: Resolve release tag
id: release_tag
shell: pwsh
run: |
if ('${{ github.event_name }}' -eq 'workflow_dispatch') {
$tag = '${{ inputs.tag_name }}'
} elseif ('${{ github.ref }}'.StartsWith('refs/tags/')) {
$tag = '${{ github.ref_name }}'
} else {
$rootBuild = Get-Content -LiteralPath 'build.gradle.kts' -Raw
if ($rootBuild -notmatch 'val\s+javaShroudVersion\s*=\s*"([^"]+)"') {
throw 'Unable to resolve javaShroudVersion from build.gradle.kts.'
}
$tag = "v$($Matches[1])"
}
if ($tag -notmatch '^v\d+\.\d+\.\d+(?:-[A-Za-z0-9.-]+)?$') {
throw "Invalid release tag: $tag"
}
git fetch --force origin "refs/tags/$tag:refs/tags/$tag"
$tagSha = (git rev-list -n 1 $tag).Trim()
$headSha = (git rev-parse HEAD).Trim()
if ($tagSha -ne $headSha) {
throw "Release tag $tag points to $tagSha, but checked out commit is $headSha. Push main/dev first, then recreate the tag on the release commit."
}
"tag=$tag" | Out-File -FilePath $env:GITHUB_OUTPUT -Encoding utf8 -Append
- name: Setup GraalVM Native Image
uses: graalvm/setup-graalvm@v1
with:
java-version: "21"
distribution: "graalvm"
components: "native-image"
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: "1.25.4"
cache-dependency-path: desktop-app/go.sum
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "24"
- name: Enable Corepack
shell: pwsh
run: corepack enable
- name: Install Wails CLI
shell: pwsh
run: |
go install github.com/wailsapp/wails/v2/cmd/wails@v2.12.0
$goBin = Join-Path (go env GOPATH) "bin"
$goBin | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
- name: Locate Visual Studio build tools
shell: pwsh
run: |
$vswhere = "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe"
$installPath = & $vswhere -latest -products * -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath
if (-not $installPath) {
throw "Visual Studio C++ build tools were not found."
}
$vcvarsall = Join-Path $installPath "VC\Auxiliary\Build\vcvarsall.bat"
if (-not (Test-Path -LiteralPath $vcvarsall)) {
throw "vcvarsall.bat was not found at $vcvarsall"
}
"VCVARSALL=$vcvarsall" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
- name: Build annotations jar
shell: pwsh
run: ./gradlew.bat :annotations:jar
- name: Build release
shell: cmd
env:
GRAALVM_HOME: ${{ env.JAVA_HOME }}
GOEXE: go
WAILS_EXE: wails
run: build-release.bat
- name: Package release
shell: pwsh
run: Compress-Archive -Path "build\release\javashroud-windows-amd64\*" -DestinationPath "javashroud-windows-amd64.zip" -Force
- name: Publish GitHub Release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ steps.release_tag.outputs.tag }}
name: JavaShroud ${{ steps.release_tag.outputs.tag }}
body_path: RELEASE_NOTES.md
draft: false
prerelease: false
make_latest: true
files: |
javashroud-windows-amd64.zip
build/annotations/libs/javashroud-annotations-*.jar