-
Notifications
You must be signed in to change notification settings - Fork 0
81 lines (69 loc) · 2.47 KB
/
release-cli-runtime.yml
File metadata and controls
81 lines (69 loc) · 2.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
name: Release CLI runtime
on:
push:
tags:
- "v*"
workflow_dispatch:
inputs:
tag_name:
description: "GitHub Release tag to attach the CLI runtime to"
required: true
type: string
permissions:
contents: write
env:
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: "true"
RUNTIME_TARGET_DIR: "target"
jobs:
release-cli-runtime:
runs-on: ubuntu-latest
if: startsWith(github.event.inputs.tag_name || github.ref_name, 'v')
steps:
- name: Check out repository
uses: actions/checkout@v4
with:
ref: ${{ github.event.inputs.tag_name || github.ref }}
- name: Set up Java 21 for build
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: "21"
cache: maven
- name: Build
run: mvn -B package
- name: Prepare release assets
env:
TAG_NAME: ${{ github.event.inputs.tag_name || github.ref_name }}
run: |
set -euo pipefail
VERSION="${TAG_NAME#v}"
ARTIFACT_ID="$(mvn help:evaluate -Dexpression=project.artifactId -q -DforceStdout)"
POM_VERSION="$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)"
echo "RELEASE_ARTIFACT_ID=${ARTIFACT_ID}" >> "${GITHUB_ENV}"
case "${VERSION}" in
"${POM_VERSION}"|"${POM_VERSION}".*) ;;
*)
echo "Release tag version (${VERSION}) must match pom.xml version (${POM_VERSION}) or add a dot suffix such as ${POM_VERSION}.2." >&2
exit 1
;;
esac
mkdir -p release-assets
cp "${RUNTIME_TARGET_DIR}/${ARTIFACT_ID}-${POM_VERSION}.jar" "release-assets/${ARTIFACT_ID}-${VERSION}.jar"
cp "${RUNTIME_TARGET_DIR}/${ARTIFACT_ID}-${POM_VERSION}-sources.jar" "release-assets/${ARTIFACT_ID}-sources-${VERSION}.jar"
- name: Set up Java 8 for runtime verification
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: "8"
- name: Verify CLI runtime asset
run: |
set -euo pipefail
java -jar release-assets/${RELEASE_ARTIFACT_ID}-[0-9]*.jar --version
- name: Upload CLI runtime to GitHub Release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ github.event.inputs.tag_name || github.ref_name }}
files: release-assets/*
overwrite_files: true
draft: false
prerelease: false