|
| 1 | +name: Update dependencies |
| 2 | + |
| 3 | +on: |
| 4 | + # Allow manual executions |
| 5 | + workflow_dispatch: |
| 6 | + # Run nightly |
| 7 | + schedule: |
| 8 | + - cron: '0 0 * * *' |
| 9 | + |
| 10 | +jobs: |
| 11 | + propose_github_release_updates: |
| 12 | + runs-on: ubuntu-22.04 |
| 13 | + strategy: |
| 14 | + matrix: |
| 15 | + include: |
| 16 | + - key: kolla |
| 17 | + path: src/kayobe-config/etc/kayobe/stackhpc.yml |
| 18 | + repository: stackhpc/kolla |
| 19 | + search_regex: 'stackhpc_kolla_source_version\:.*$' |
| 20 | + prefix: 'stackhpc_kolla_source_version\: ' |
| 21 | + |
| 22 | + - key: kolla-ansible |
| 23 | + path: src/kayobe-config/etc/kayobe/stackhpc.yml |
| 24 | + repository: stackhpc/kolla-ansible |
| 25 | + search_regex: 'stackhpc_kolla_ansible_source_version\:.*$' |
| 26 | + prefix: 'stackhpc_kolla_ansible_source_version\: ' |
| 27 | + |
| 28 | + - key: kayobe |
| 29 | + path: src/kayobe-config/requirements.txt |
| 30 | + repository: stackhpc/kayobe |
| 31 | + search_regex: 'kayobe@stackhpc\/.*$' |
| 32 | + prefix: 'kayobe@' |
| 33 | + permissions: |
| 34 | + contents: write |
| 35 | + pull-requests: write |
| 36 | + name: ${{ matrix.key }} |
| 37 | + steps: |
| 38 | + - name: Checkout |
| 39 | + uses: actions/checkout@v4 |
| 40 | + with: |
| 41 | + path: ${{ github.workspace }}/src/kayobe-config |
| 42 | + |
| 43 | + - name: Determine OpenStack release |
| 44 | + id: openstack_release |
| 45 | + run: | |
| 46 | + BRANCH=$(awk -F'=' '/defaultbranch/ {print $2}' .gitreview) |
| 47 | + echo "openstack_release=${BRANCH}" | sed -E "s,(stable|unmaintained)/,," >> $GITHUB_OUTPUT |
| 48 | + working-directory: ${{ github.workspace }}/src/kayobe-config |
| 49 | + |
| 50 | + - name: Checkout the dependency repo |
| 51 | + uses: actions/checkout@v4 |
| 52 | + with: |
| 53 | + repository: ${{ matrix.repository }} |
| 54 | + ref: stackhpc/${{ steps.openstack_release.outputs.openstack_release }} |
| 55 | + fetch-tags: true |
| 56 | + path: ${{ github.workspace }}/src/${{ matrix.key }} |
| 57 | + |
| 58 | + - name: Get latest tag |
| 59 | + id: latest_tag |
| 60 | + run: | |
| 61 | + TAG=$(git describe --tags --abbrev=0 --match stackhpc/\*) |
| 62 | + echo latest_tag=${TAG} >> $GITHUB_OUTPUT |
| 63 | + working-directory: ${{ github.workspace }}/src/${{ matrix.key }} |
| 64 | + |
| 65 | + - name: Update dependency key |
| 66 | + run: | |
| 67 | + TAG_OVERRIDE=$(echo $TAG | sed 's/\//\\\//g') |
| 68 | + sed -i "s/$SEARCH/$PREFIX$TAG_OVERRIDE/g" $REQUIREMENTS |
| 69 | + env: |
| 70 | + PREFIX: ${{ matrix.prefix }} |
| 71 | + TAG: ${{ steps.latest_tag.outputs.latest_tag }} |
| 72 | + REQUIREMENTS: ${{ github.workspace }}/${{ matrix.path }} |
| 73 | + SEARCH: ${{ matrix.search_regex }} |
| 74 | + |
| 75 | + - name: Propose changes via PR if required |
| 76 | + uses: peter-evans/create-pull-request@v7 |
| 77 | + with: |
| 78 | + path: ${{ github.workspace }}/src/kayobe-config |
| 79 | + commit-message: >- |
| 80 | + Bump ${{ matrix.key }} to ${{ steps.latest_tag.outputs.latest_tag }} |
| 81 | + branch: update-dependency/${{ matrix.key }} |
| 82 | + delete-branch: true |
| 83 | + title: >- |
| 84 | + Bump ${{ matrix.key }} to ${{ steps.latest_tag.outputs.latest_tag }} |
| 85 | + body: > |
| 86 | + This PR was created automatically to update |
| 87 | + ${{ matrix.key }} to ${{ steps.latest_tag.outputs.latest_tag }}. |
0 commit comments