Skip to content

Commit 9324518

Browse files
authored
Merge pull request #71 from ngundotra/dockerfile-script-ci-0
Add workflow for generating dockerfiles on manual trigger
2 parents 6cc033c + 39af219 commit 9324518

File tree

4 files changed

+173
-5
lines changed

4 files changed

+173
-5
lines changed
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
name: Generate Dockerfiles
2+
3+
on:
4+
workflow_dispatch:
5+
6+
permissions:
7+
contents: write
8+
pull-requests: write
9+
10+
jobs:
11+
generate-dockerfiles:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/create-github-app-token@v1
15+
id: generate-token
16+
with:
17+
app-id: ${{ vars.ROBO_PR_APP_ID }}
18+
private-key: ${{ secrets.ROBO_PR_CLIENT_SECRET }}
19+
20+
- name: Checkout repository
21+
uses: actions/checkout@v4
22+
23+
- name: Install uv
24+
uses: astral-sh/setup-uv@v3
25+
with:
26+
enable-cache: true
27+
cache-dependency-glob: "uv.lock"
28+
29+
- name: "Set up Python"
30+
uses: actions/setup-python@v5
31+
with:
32+
python-version-file: "pyproject.toml"
33+
34+
- name: Install dependencies with uv
35+
run: |
36+
uv sync --all-extras --dev
37+
38+
- name: Run generate_dockerfiles.py
39+
run: uv run generate_dockerfiles.py
40+
41+
- name: Create Pull Request
42+
uses: peter-evans/create-pull-request@v5
43+
with:
44+
token: ${{ steps.generate-token.outputs.token }}
45+
commit-message: Update Dockerfiles
46+
title: 'Update Dockerfiles'
47+
body: |
48+
This PR updates the Dockerfiles in the `docker/` directory.
49+
50+
Generated automatically by the Generate Dockerfiles workflow.
51+
branch: update-dockerfiles
52+
delete-branch: true
53+
base: master
54+
labels: |
55+
automated pr
56+
dockerfiles

generate_dockerfiles.py

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -115,15 +115,24 @@ def get_toolchain(version_tag):
115115
)
116116

117117
path = f"docker/{release}.Dockerfile"
118-
with open(path, "r") as f:
119-
prev = f.read()
120-
121-
if prev != dockerfile:
118+
119+
# Check if the file exists before trying to read it
120+
if os.path.exists(path):
121+
with open(path, "r") as f:
122+
prev = f.read()
123+
124+
if prev != dockerfile:
125+
dirty_set.add(release.strip("v"))
126+
print(f"{release} needs to be updated")
127+
else:
128+
# If the file doesn't exist, consider it as dirty
122129
dirty_set.add(release.strip("v"))
123-
print(release)
130+
print(f"{release} is new and needs to be created")
124131

132+
# Write the new or updated Dockerfile
125133
with open(path, "w") as f:
126134
f.write(dockerfile)
135+
127136
dockerfiles[release] = path
128137

129138
print(RUST_DOCKER_IMAGESHA_MAP)

pyproject.toml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
[project]
2+
name = "solana-verifiable-build"
3+
version = "0.1.0"
4+
description = "Add your description here"
5+
readme = "README.md"
6+
requires-python = ">=3.12"
7+
dependencies = [
8+
"requests>=2.32.3",
9+
]

uv.lock

Lines changed: 94 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)