Skip to content

Commit 765a3aa

Browse files
committed
test: git push
1 parent c4badbe commit 765a3aa

File tree

1 file changed

+66
-10
lines changed

1 file changed

+66
-10
lines changed

.github/workflows/pi_build.yml

Lines changed: 66 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,15 @@ on:
66
# Special permissions required for OIDC authentication
77
permissions:
88
id-token: write
9-
contents: write
9+
contents: read
1010
actions: read
1111

1212
env:
1313
GH_TOKEN: ${{ secrets.GH_TOKEN }}
1414

1515
jobs:
1616
pi-diff:
17-
name: 'Parent Images: Diff PI Types'
17+
name: 'Parent Images: Diff Types'
1818
runs-on: ubuntu-latest
1919
environment: dev
2020
env:
@@ -40,17 +40,13 @@ jobs:
4040
bash cicd-deployment-scripts/pi/diff.sh \
4141
-p "${{ github.event.pull_request.number }}"
4242
43-
pi-build:
44-
name: 'Parent Images: Docker Build'
43+
pi-compile:
44+
name: 'Parent Images: Compile Requirements'
4545
runs-on: ubuntu-latest
4646
needs: [pi-diff]
4747
environment: dev
4848
env:
4949
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 }}
5450
strategy:
5551
matrix:
5652
parent_image_type: ${{ fromJson(needs.pi-diff.outputs.updated_parent_types) }}
@@ -83,10 +79,70 @@ jobs:
8379
pip-compile requirements/${{ matrix.parent_image_type }}-requirements.in
8480
8581
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+
8785
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
8987
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+
90146
gh pr create \
91147
--title "${{ github.event.pull_request.title }}" \
92148
--body "${{ github.event.pull_request.body }}" \

0 commit comments

Comments
 (0)