generated from astronomer/templates
-
Notifications
You must be signed in to change notification settings - Fork 0
48 lines (44 loc) · 1.88 KB
/
update-runtime-versions.yaml
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
# If you're a new Astro user, discard this workflow.
name: Astronomer Maintenance CI - Update Astro Runtime Version
on:
workflow_dispatch: # Manual trigger
schedule:
- cron: "0 16 * * *" # Once a day at noon ET
env:
ENABLE_RUNTIME_AUTO_UPDATES: false
jobs:
update-runtime-version:
# Only run this job if the repository is the original example-dags repository on main branch
# so we don't accidentally update the runtime version in forks / template repositories
if: github.repository == 'astronomer/templates'
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}
- name: Get latest Astronomer Runtime version
id: get_latest_runtime
run: |
# Fetch the latest runtime version from updates.astronomer.io
response=$(curl -s https://updates.astronomer.io/astronomer-runtime)
# Extract the latest runtime version using jq
latest_version=$(echo $response | jq -r '.runtimeVersions | keys | sort_by(. | split(".") | map(tonumber)) | last')
# Set the latest runtime version as an output
echo "LATEST_RUNTIME=$latest_version" >> $GITHUB_ENV
- name: Update Dockerfiles with latest runtime version
run: |
latest_runtime=$LATEST_RUNTIME
export latest_runtime
find . -maxdepth 1 -type d ! -path . -exec sh -c '
for dir; do
if [ -f "$dir/Dockerfile" ]; then
sed -i "s|FROM quay.io/astronomer/astro-runtime:.*|FROM quay.io/astronomer/astro-runtime:$latest_runtime|" "$dir/Dockerfile"
fi
done
' sh {} +
- name: Commit changes
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: "Update Astro Runtime to ${{ ENV.LATEST_RUNTIME }}"
push_options: --force