-
Notifications
You must be signed in to change notification settings - Fork 331
Expand file tree
/
Copy pathadd-release-to-cloudfoundry.yaml
More file actions
65 lines (63 loc) · 2.5 KB
/
add-release-to-cloudfoundry.yaml
File metadata and controls
65 lines (63 loc) · 2.5 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
name: Add release to Cloud Foundry
on:
release:
types:
- released
jobs:
update-releases:
permissions:
contents: write # Required to commit and push changes to the repository
runs-on: ubuntu-latest
steps:
- name: Checkout "cloudfoundry" branch
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # 6.0.2
with:
ref: cloudfoundry
- name: Get release version
id: get-release-version
env:
TAG_NAME: ${{ github.event.release.tag_name }}
run: echo "VERSION=$(echo ${TAG_NAME/#v/})" >> $GITHUB_OUTPUT
- name: Get release URL
id: get-release-url
run: |
echo "URL=https://repo1.maven.org/maven2/com/datadoghq/dd-java-agent/${{ steps.get-release-version.outputs.VERSION }}/dd-java-agent-${{ steps.get-release-version.outputs.VERSION }}.jar" >> $GITHUB_OUTPUT
- name: Wait for the release to be available
run: |
TRY=0
MAX_TRIES=60 # Wait up to 30 minutes
DELAY=30
while [ $TRY -lt $MAX_TRIES ]; do
if curl -s -I ${{ steps.get-release-url.outputs.URL }} | grep -q "^HTTP/.* 200"; then
break
fi
echo "Waiting for the release to be available..."
sleep $DELAY
TRY=$((TRY+1))
if [ $TRY -eq $MAX_TRIES ]; then
echo "The release is not available after 30 mins. Aborting..."
exit 1
fi
done
- name: Append release to Cloud Foundry repository
run: |
echo "${{ steps.get-release-version.outputs.VERSION }}: ${{ steps.get-release-url.outputs.URL }}" >> index.yml
- name: Commit changes
id: create-commit
run: |
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
if [[ -z "$(git status -s)" ]]; then
echo "No changes to commit, exiting."
exit 0;
fi
git add --all
git commit -m "chore: Add version ${{ steps.get-release-version.outputs.VERSION }} to Cloud Foundry"
echo "commit=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT
- name: Push changes
uses: DataDog/commit-headless@05d7b7ee023e2c7d01c47832d420c2503cd416f3 # action/v2.0.3
if: ${{ steps.create-commit.outputs.commit != '' }}
with:
branch: cloudfoundry
command: push
commits: "${{ steps.create-commit.outputs.commit }}"