61 lines
2.4 KiB
YAML
61 lines
2.4 KiB
YAML
# 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
|
|
|
|
- name: Use CLA approved github bot
|
|
run: .github/scripts/use-cla-approved-github-bot.sh
|
|
|
|
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
|
with:
|
|
ref: 'cloudfoundry'
|
|
|
|
- name: create working branch
|
|
run: git checkout -b opentelemetrybot/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.2
|
|
|
|
- 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
|
|
|
|
- name: create pr with repo changes
|
|
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 opentelemetrybot/cloudfoundry-${{ github.run_number }}-${{ github.run_attempt }}
|
|
gh pr create --base cloudfoundry \
|
|
--head opentelemetrybot/cloudfoundry-${{ github.run_number }}-${{ github.run_attempt }} \
|
|
--title 'Release updates for Cloudfoundry Repo' \
|
|
--body '[Created by Github action]'
|
|
env:
|
|
# not using secrets.GITHUB_TOKEN since pull requests from that token do not run workflows
|
|
GITHUB_TOKEN: ${{ secrets.OPENTELEMETRYBOT_GITHUB_TOKEN }}
|