-
Notifications
You must be signed in to change notification settings - Fork 11
72 lines (70 loc) · 2.47 KB
/
Copy pathupdate_assets.yml
File metadata and controls
72 lines (70 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
name: Update Release Assets
run-name: Update assets for ${{ inputs.release_tag }}
on:
workflow_dispatch:
inputs:
release_tag:
type: string
description: "Release tag"
required: true
push:
tags:
- v_*.*.*
permissions:
contents: write
actions: read
jobs:
update-assets-and-releaase:
if: (startsWith(github.event.ref, 'refs/tags/v_') || inputs.release_tag != '') && !endsWith(github.event.ref, '-SNAPSHOT')
runs-on: ubuntu-latest
steps:
- name: Setup System
id: setup-system
run: |
sudo apt update && sudo apt install -y wget unzip
- name: Download Assets
id: download-assets
timeout-minutes: 30
run: |
# ignore errors to allow reattempted downloads
set +e
TAG=${{ inputs.release_tag }}
if [ -z "$TAG" ]; then
TAG="$GITHUB_REF_NAME"
fi
VERSION=$(echo "${TAG}" | sed -e 's/v_//g')
ASSET_URL="https://repo1.maven.org/maven2/com/datadoghq/ddprof/${VERSION}/ddprof-${VERSION}.jar"
RESULT=1
while [ $RESULT -ne 0 ]; do
wget -q $ASSET_URL
RESULT=$?
if [ $RESULT -ne 0 ]; then
echo "Artifact not available. Retrying in 30 seconds."
sleep 30
fi
done
echo "VERSION=${VERSION}" >> $GITHUB_ENV
- name: Prepare Assets
id: prepare-assets
run: |
LIB_BASE_DIR="META-INF/native-libs"
mkdir assets
cp ddprof-${VERSION}.jar assets/ddprof.jar
cp ddprof-${VERSION}.jar assets/ddprof-${VERSION}.jar
unzip ddprof-${VERSION}.jar
mv ${LIB_BASE_DIR}/linux-arm64/libjavaProfiler.so assets/libjavaProfiler_linux-arm64.so
mv ${LIB_BASE_DIR}/linux-x64/libjavaProfiler.so assets/libjavaProfiler_linux-x64.so
mv ${LIB_BASE_DIR}/linux-arm64-musl/libjavaProfiler.so assets/libjavaProfiler_linux-arm64-musl.so
mv ${LIB_BASE_DIR}/linux-x64-musl/libjavaProfiler.so assets/libjavaProfiler_linux-x64-musl.so
- name: Update release ${{ inputs.release_tag }}
id: update-release
uses: ncipollo/release-action@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
tag: "v_${{ env.VERSION }}"
allowUpdates: true
generateReleaseNotes: true
omitBodyDuringUpdate: true
artifacts: assets/ddprof*.jar,assets/*.so
draft: false
makeLatest: true