6
6
# Special permissions required for OIDC authentication
7
7
permissions :
8
8
id-token : write
9
- contents : write
9
+ contents : read
10
10
actions : read
11
11
12
12
env :
13
13
GH_TOKEN : ${{ secrets.GH_TOKEN }}
14
14
15
15
jobs :
16
16
pi-diff :
17
- name : ' Parent Images: Diff PI Types'
17
+ name : ' Parent Images: Diff Types'
18
18
runs-on : ubuntu-latest
19
19
environment : dev
20
20
env :
@@ -40,17 +40,13 @@ jobs:
40
40
bash cicd-deployment-scripts/pi/diff.sh \
41
41
-p "${{ github.event.pull_request.number }}"
42
42
43
- pi-build :
44
- name : ' Parent Images: Docker Build '
43
+ pi-compile :
44
+ name : ' Parent Images: Compile Requirements '
45
45
runs-on : ubuntu-latest
46
46
needs : [pi-diff]
47
47
environment : dev
48
48
env :
49
49
PYTHON_VERSION : ${{ vars.PYTHON_VERSION }}
50
- DEV_CONTAINER_REGISTRY : ${{ vars.DEV_CONTAINER_REGISTRY }}
51
- DEV_LOGIN_USERNAME : ${{ secrets.DEV_LOGIN_USERNAME }}
52
- DEV_LOGIN_PASSWORD : ${{ secrets.DEV_LOGIN_PASSWORD }}
53
- IMAGE_TAG : ${{ github.event_name == 'release' && github.event.release.tag_name || github.event.pull_request.head.ref }}
54
50
strategy :
55
51
matrix :
56
52
parent_image_type : ${{ fromJson(needs.pi-diff.outputs.updated_parent_types) }}
@@ -83,10 +79,70 @@ jobs:
83
79
pip-compile requirements/${{ matrix.parent_image_type }}-requirements.in
84
80
85
81
cd ${{ github.workspace }}
86
- git checkout -b ${{ github.event.pull_request.head.ref }}
82
+ git checkout ${{ github.event.pull_request.head.ref }} || git checkout -b ${{ github.event.pull_request.head.ref }}
83
+ git push origin ${{ github.event.pull_request.head.ref }} && git pull origin ${{ github.event.pull_request.head.ref }}
84
+
87
85
git add submodules
88
- git commit -m "${{ github.event.pull_request.title }}"
86
+ git commit -m "ci: update submodules to origin/ ${{ github.event.pull_request.head.ref }}" || true
89
87
git push origin ${{ github.event.pull_request.head.ref }}
88
+
89
+ gh pr create \
90
+ --title "${{ github.event.pull_request.title }}" \
91
+ --body "${{ github.event.pull_request.body }}" \
92
+ --base dev \
93
+ --head ${{ github.event.pull_request.head.ref }} \
94
+ --repo ${{ github.repository_owner }}/refinery-${{ matrix.parent_image_type }}-parent-image
95
+
96
+
97
+ pi-build :
98
+ name : ' Parent Images: Docker Build'
99
+ runs-on : ubuntu-latest
100
+ needs : [pi-diff, pi-compile]
101
+ environment : dev
102
+ env :
103
+ PYTHON_VERSION : ${{ vars.PYTHON_VERSION }}
104
+ DEV_CONTAINER_REGISTRY : ${{ vars.DEV_CONTAINER_REGISTRY }}
105
+ DEV_LOGIN_USERNAME : ${{ secrets.DEV_LOGIN_USERNAME }}
106
+ DEV_LOGIN_PASSWORD : ${{ secrets.DEV_LOGIN_PASSWORD }}
107
+ IMAGE_TAG : ${{ github.event_name == 'release' && github.event.release.tag_name || github.event.pull_request.head.ref }}
108
+ strategy :
109
+ matrix :
110
+ parent_image_type : ${{ fromJson(needs.pi-diff.outputs.updated_parent_types) }}
111
+ steps :
112
+ - name : Checkout repository
113
+ uses : actions/checkout@v4
114
+ with :
115
+ repository : ' ${{ github.repository_owner }}/refinery-${{ matrix.parent_image_type }}-parent-image'
116
+ submodules : ' true'
117
+
118
+ - name : GitHub Configuration
119
+ run : git config --global url."https://oauth2:${{ secrets.GH_TOKEN }}@github.com".insteadOf https://github.com
120
+
121
+ - name : Set up Python
122
+ uses : actions/setup-python@v5
123
+ with :
124
+ python-version : ${{ env.PYTHON_VERSION }}
125
+
126
+ - name : Install Dependencies
127
+ run : python -m pip install pip-tools
128
+
129
+ - name : Compile Artifacts
130
+ run : |
131
+ cd ${{ github.workspace }}/submodules/parent-images
132
+ git checkout ${{ github.event.pull_request.head.ref }}
133
+ pip-compile requirements/${{ matrix.parent_image_type }}-requirements.in
134
+
135
+ cd ${{ github.workspace }}
136
+ git checkout ${{ github.event.pull_request.head.ref }} || git checkout -b ${{ github.event.pull_request.head.ref }}
137
+ git push origin ${{ github.event.pull_request.head.ref }} && git pull origin ${{ github.event.pull_request.head.ref }}
138
+
139
+ git config user.email "devtools@kern.ai"
140
+ git config user.name "GitHub Actions"
141
+
142
+ git add submodules
143
+ git commit -m "ci: update submodules to origin/${{ github.event.pull_request.head.ref }}" || true
144
+ git push origin ${{ github.event.pull_request.head.ref }}
145
+
90
146
gh pr create \
91
147
--title "${{ github.event.pull_request.title }}" \
92
148
--body "${{ github.event.pull_request.body }}" \
0 commit comments