Update cloudfoundry release index #566
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This action updates the CloudFoundry java-buildpack release index after each release. | |
# See https://github.com/cloudfoundry/java-buildpack/blob/main/docs/extending-repositories.md | |
# Prerequisite: the repo must have a branch named "cloudfoundry". | |
name: Update cloudfoundry release index | |
on: | |
schedule: | |
- cron: '25 4 * * *' # Daily at 4:25 AM UTC | |
workflow_dispatch: | |
permissions: | |
contents: read | |
jobs: | |
update-cloudfoundry-index-yml: | |
permissions: | |
contents: write # for git push to PR branch | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
# need to run this script before we switch branches | |
# since the script doesn't exist on the cloudfoundry branch | |
- name: Use CLA approved github bot | |
run: .github/scripts/use-cla-approved-bot.sh | |
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
with: | |
ref: 'cloudfoundry' | |
- name: create working branch | |
run: git checkout -b otelbot/cloudfoundry-${{ github.run_number }}-${{ github.run_attempt }} | |
- name: install xq (which is part of yq) | |
run: | | |
sudo apt-get install jq python3-pip | |
pip install yq==3.4.3 | |
- name: update index.yml | |
run: | | |
wget https://repo1.maven.org/maven2/io/opentelemetry/javaagent/opentelemetry-javaagent/maven-metadata.xml | |
xq -r .metadata.versioning.versions.version[] maven-metadata.xml | sed -E 's/(.*)/\1: https:\/\/repo1.maven.org\/maven2\/io\/opentelemetry\/javaagent\/opentelemetry-javaagent\/\1\/opentelemetry-javaagent-\1.jar/' > index.yml | |
- name: display changes | |
run: git diff | |
- uses: actions/create-github-app-token@0d564482f06ca65fa9e77e2510873638c82206f2 # v1.11.5 | |
id: otelbot-token | |
with: | |
app-id: ${{ vars.OTELBOT_APP_ID }} | |
private-key: ${{ secrets.OTELBOT_PRIVATE_KEY }} | |
- name: create pr with repo changes | |
env: | |
# not using secrets.GITHUB_TOKEN since pull requests from that token do not run workflows | |
GH_TOKEN: ${{ steps.otelbot-token.outputs.token }} | |
run: | | |
git add index.yml | |
if git diff-index --quiet --cached HEAD ; then | |
echo "index.yml already current" | |
exit 0 | |
fi | |
git commit -m "Updated index.yml" | |
git push --set-upstream origin otelbot/cloudfoundry-${{ github.run_number }}-${{ github.run_attempt }} | |
gh pr create --base cloudfoundry \ | |
--head otelbot/cloudfoundry-${{ github.run_number }}-${{ github.run_attempt }} \ | |
--title 'Release updates for Cloudfoundry Repo' \ | |
--body '[Created by Github action]' |