forked from eclipse-mat/mat
-
Notifications
You must be signed in to change notification settings - Fork 1
80 lines (68 loc) · 2.48 KB
/
release-cli.yaml
File metadata and controls
80 lines (68 loc) · 2.48 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
name: Release MAT CLI
on:
push:
tags:
- '*'
workflow_dispatch:
permissions:
contents: write
env:
MAVEN_VERSION: 3.9.12
HOMEBREW_TAP_REPO: Demogorgon314/homebrew-mat-cli
HOMEBREW_TAP_WORKFLOW: update-formula.yml
jobs:
release_cli:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Java
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
architecture: x64
- name: Install Apache Maven 3.9
run: |
curl -fsSL https://archive.apache.org/dist/maven/maven-3/${MAVEN_VERSION}/binaries/apache-maven-${MAVEN_VERSION}-bin.tar.gz | tar xzf - -C /opt/
echo "/opt/apache-maven-${MAVEN_VERSION}/bin/" >> $GITHUB_PATH
echo "MAVEN_HOME=/opt/apache-maven-${MAVEN_VERSION}/bin/" >> $GITHUB_ENV
- name: Build standalone MAT CLI zip
run: |
cd parent
mvn --version
mvn clean package -DskipTests -Dmat-product=mat-cli -Dmaven.repo.local="${RUNNER_TEMP}/m2"
- name: Prepare release asset
run: |
mkdir -p release-assets
cp org.eclipse.mat.product/target/extraArtifacts/mat-cli.zip "release-assets/mat-cli-${GITHUB_REF_NAME}.zip"
- name: Upload release asset
uses: actions/upload-artifact@v4
with:
name: mat-cli-${{ github.ref_name }}
path: release-assets/mat-cli-${{ github.ref_name }}.zip
- name: Publish GitHub release
if: github.event_name == 'push'
uses: softprops/action-gh-release@v2
with:
files: release-assets/mat-cli-${{ github.ref_name }}.zip
generate_release_notes: true
name: MAT CLI ${{ github.ref_name }}
- name: Trigger Homebrew tap update
if: github.event_name == 'push'
env:
GH_TOKEN: ${{ secrets.HOMEBREW_TAP_TOKEN }}
run: |
if [ -z "${GH_TOKEN}" ]; then
echo "::warning::HOMEBREW_TAP_TOKEN is not configured; skipping Homebrew tap update."
exit 0
fi
curl --fail --silent --show-error \
--retry 3 \
--retry-all-errors \
--retry-delay 5 \
-X POST \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer ${GH_TOKEN}" \
"https://api.github.com/repos/${HOMEBREW_TAP_REPO}/actions/workflows/${HOMEBREW_TAP_WORKFLOW}/dispatches" \
-d '{"ref":"main"}'