|
| 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 | + version_jsonpath: stackhpc_kolla_source_version |
| 20 | + |
| 21 | + - key: kolla-ansible |
| 22 | + path: src/kayobe-config/etc/kayobe/stackhpc.yml |
| 23 | + repository: stackhpc/kolla-ansible |
| 24 | + version_jsonpath: stackhpc_kolla_ansible_source_version |
| 25 | + |
| 26 | + - key: kayobe |
| 27 | + path: src/kayobe-config/requirements.txt |
| 28 | + repository: stackhpc/kayobe |
| 29 | + |
| 30 | + name: ${{ matrix.key }} |
| 31 | + steps: |
| 32 | + - name: Checkout |
| 33 | + uses: actions/checkout@v4 |
| 34 | + path: src/kayobe-config |
| 35 | + |
| 36 | + - name: Determine OpenStack release |
| 37 | + id: openstack_release |
| 38 | + run: | |
| 39 | + BRANCH=$(awk -F'=' '/defaultbranch/ {print $2}' src/kayobe-config/.gitreview) |
| 40 | + echo "openstack_release=${BRANCH}" | sed -E "s,(stable|unmaintained)/,," >> $GITHUB_OUTPUT |
| 41 | +
|
| 42 | + - name: Checkout the dependency repo |
| 43 | + uses: actions/checkout@v4 |
| 44 | + with: |
| 45 | + repository: ${{ matrix.repository }} |
| 46 | + ref: stackhpc/${{ steps.openstack_release.outputs.openstack_release }} |
| 47 | + path: src/${{ matrix.key }} |
| 48 | + |
| 49 | + - name: Get latest tag |
| 50 | + id: latest_tag |
| 51 | + run: | |
| 52 | + TAG=$(git describe --tags --abbrev=0 --match stackhpc/\*) |
| 53 | + echo latest_tag=${TAG} >> $GITHUB_OUTPUT |
| 54 | +
|
| 55 | + - name: Update dependency key (kolla) |
| 56 | + uses: azimuth-cloud/github-actions/config-update@master |
| 57 | + with: |
| 58 | + path: ${{ matrix.path }} |
| 59 | + updates: | |
| 60 | + ${{ matrix.version_jsonpath }}=${{ steps.latest_tag.outputs.latest_tag }} |
| 61 | + if: contains(matrix.key, 'kolla') |
| 62 | + |
| 63 | + - name: Update dependency key (kayobe) |
| 64 | + run: | |
| 65 | + REPLACE=$(sed -i "s/@stackhpc\/.*$/$TAG/g" $REQUIREMENTS) |
| 66 | + if: contains(matrix.key, 'kayobe') |
| 67 | + env: |
| 68 | + TAG: ${{ steps.latest_tag.outputs.latest_tag }} |
| 69 | + REQUIREMENTS: ${{ matrix.path }} |
| 70 | + |
| 71 | + - name: Generate app token for PR |
| 72 | + uses: azimuth-cloud/github-actions/generate-app-token@master |
| 73 | + id: generate-app-token |
| 74 | + with: |
| 75 | + repository: ${{ github.repository }} |
| 76 | + app-id: ${{ secrets.AUTOMATION_APP_ID }} |
| 77 | + app-private-key: ${{ secrets.AUTOMATION_APP_PRIVATE_KEY }} |
| 78 | + |
| 79 | + - name: Propose changes via PR if required |
| 80 | + uses: peter-evans/create-pull-request@v7 |
| 81 | + with: |
| 82 | + token: ${{ steps.generate-app-token.outputs.token }} |
| 83 | + path: src/kayobe-config |
| 84 | + commit-message: >- |
| 85 | + Bump ${{ matrix.key }} to ${{ steps.next.outputs.version }} |
| 86 | + branch: update-dependency/${{ matrix.key }} |
| 87 | + delete-branch: true |
| 88 | + title: >- |
| 89 | + Bump ${{ matrix.key }} to ${{ steps.next.outputs.version }} |
| 90 | + body: > |
| 91 | + This PR was created automatically to update |
| 92 | + ${{ matrix.key }} to ${{ steps.next.outputs.version }}. |
| 93 | + labels: | |
| 94 | + stackhpc-ci |
0 commit comments