Skip to content

1.55.0

1.55.0 #44

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@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # 5.0.0
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@5a0f3876e0fbdd3a86b3e008acf4ec562db59eee # action/v2.0.1
if: ${{ steps.create-commit.outputs.commit != '' }}
with:
branch: cloudfoundry
command: push
commits: "${{ steps.create-commit.outputs.commit }}"