-
Notifications
You must be signed in to change notification settings - Fork 21
82 lines (74 loc) · 2.78 KB
/
update-dependencies.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
name: Update dependencies
on:
workflow_call:
inputs:
openstack_version:
description: OpenStack version
type: string
required: true
jobs:
propose_github_release_updates:
runs-on: ubuntu-22.04
strategy:
matrix:
include:
- key: kolla
path: src/kayobe-config/etc/kayobe/stackhpc.yml
repository: stackhpc/kolla
search_regex: 'stackhpc_kolla_source_version\:.*$'
prefix: 'stackhpc_kolla_source_version\: '
- key: kolla-ansible
path: src/kayobe-config/etc/kayobe/stackhpc.yml
repository: stackhpc/kolla-ansible
search_regex: 'stackhpc_kolla_ansible_source_version\:.*$'
prefix: 'stackhpc_kolla_ansible_source_version\: '
- key: kayobe
path: src/kayobe-config/requirements.txt
repository: stackhpc/kayobe
search_regex: 'kayobe@stackhpc\/.*$'
prefix: 'kayobe@'
permissions:
contents: write
pull-requests: write
name: ${{ matrix.key }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ inputs.openstack_version }}
path: ${{ github.workspace }}/src/kayobe-config
- name: Checkout the dependency repo
uses: actions/checkout@v4
with:
repository: ${{ matrix.repository }}
ref: ${{ inputs.openstack_version }}
fetch-tags: true
path: ${{ github.workspace }}/src/${{ matrix.key }}
- name: Get latest tag
id: latest_tag
run: |
TAG=$(git describe --tags --abbrev=0 --match stackhpc/\*)
echo latest_tag=${TAG} >> $GITHUB_OUTPUT
working-directory: ${{ github.workspace }}/src/${{ matrix.key }}
- name: Update dependency key
run: |
TAG_OVERRIDE=$(echo $TAG | sed 's/\//\\\//g')
sed -i "s/$SEARCH/$PREFIX$TAG_OVERRIDE/g" $REQUIREMENTS
env:
PREFIX: ${{ matrix.prefix }}
TAG: ${{ steps.latest_tag.outputs.latest_tag }}
REQUIREMENTS: ${{ github.workspace }}/${{ matrix.path }}
SEARCH: ${{ matrix.search_regex }}
- name: Propose changes via PR if required
uses: peter-evans/create-pull-request@v7
with:
path: ${{ github.workspace }}/src/kayobe-config
commit-message: >-
Bump ${{ matrix.key }} to ${{ steps.latest_tag.outputs.latest_tag }}
branch: update-dependency/${{ matrix.key }}/${{ inputs.openstack_version }}
delete-branch: true
title: >-
Bump ${{ matrix.key }} to ${{ steps.latest_tag.outputs.latest_tag }}
body: >
This PR was created automatically to update
${{ matrix.key }} to ${{ steps.latest_tag.outputs.latest_tag }}.