Skip to content

release: update version file for v1.12.0 #143

release: update version file for v1.12.0

release: update version file for v1.12.0 #143

name: Create Dependency Version Update PR in Longhorn Repo
on:
push:
branches:
- master
- "v*"
permissions:
contents: read
pull-requests: read
concurrency:
group: dep-versions-update-${{ github.ref_name }}
cancel-in-progress: true
jobs:
create-pull-request:
runs-on: ubuntu-latest
steps:
- name: Install Dependencies
run: |
set -euxo pipefail
sudo apt update -y
sudo apt install -y jq wget
# Install yq for YAML processing
wget -O /tmp/yq \
https://github.com/mikefarah/yq/releases/download/v4.52.5/yq_linux_amd64
sudo mv /tmp/yq /usr/local/bin/yq
sudo chmod +x /usr/local/bin/yq
- name: Prepare Packages
run: |
set -euxo pipefail
# Install Helm
curl -fsSL -o /tmp/get_helm.sh \
https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3
chmod 700 /tmp/get_helm.sh
DESIRED_VERSION=v3.20.2 /tmp/get_helm.sh
- name: Set workflow variables
run: |
set -euxo pipefail
SHORT_SHA="${GITHUB_SHA:0:7}"
# Use the pushed branch as both source and target
echo "TARGET_BRANCH=${GITHUB_REF_NAME}" >> $GITHUB_ENV
echo "SHORT_SHA=${SHORT_SHA}" >> $GITHUB_ENV
- name: Create GitHub App token
id: app-token
uses: actions/create-github-app-token@fee1f7d63c2ff003460e3d139729b119787bc349
with:
app-id: ${{ secrets.LONGHORN_GITHUB_BOT_APP_ID }}
private-key: ${{ secrets.LONGHORN_GITHUB_BOT_PRIVATE_KEY }}
owner: ${{ github.repository_owner }}
permission-contents: write
permission-pull-requests: write
- name: Checkout longhorn/longhorn
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
with:
repository: longhorn/longhorn
token: ${{ steps.app-token.outputs.token }}
ref: ${{ env.TARGET_BRANCH }}
- name: Update dependency versions
id: update
run: |
set -euxo pipefail
COMPONENTS=(
backing-image-manager
longhorn-engine
longhorn-instance-manager
longhorn-manager
longhorn-share-manager
longhorn-ui
longhorn-cli
)
EXTERNALS=(
csi-attacher
csi-provisioner
csi-resizer
csi-snapshotter
csi-node-driver-registrar
livenessprobe
support-bundle-kit
)
IMAGE_FILE="deploy/longhorn-images.txt"
if [[ ! -f "${IMAGE_FILE}" ]]; then
echo "::error::${IMAGE_FILE} not found in longhorn/longhorn@${TARGET_BRANCH}"
exit 1
fi
# Fetch dependency versions from dep-versions repo
VERSIONS_URL="https://raw.githubusercontent.com/longhorn/dep-versions/refs/heads/${TARGET_BRANCH}/versions.json"
if ! curl -fsSL "${VERSIONS_URL}" -o /tmp/versions.json; then
echo "::error::Failed to fetch versions.json from ${VERSIONS_URL}"
exit 1
fi
# Validate that versions.json is valid JSON
if ! jq empty /tmp/versions.json 2>/dev/null; then
echo "::error::versions.json is not valid JSON"
exit 1
fi
component_images=()
# Preserve only Longhorn component images
while IFS= read -r line; do
for component in "${COMPONENTS[@]}"; do
if [[ "${line}" == *"${component}"* ]]; then
component_images+=("${line}")
break
fi
done
done < "${IMAGE_FILE}"
rm -f "${IMAGE_FILE}"
# Restore component images
for image in "${component_images[@]}"; do
echo "${image}" >> "${IMAGE_FILE}"
done
# Append external dependency images from versions.json
for dep in "${EXTERNALS[@]}"; do
tag="$(jq -r --arg dep "${dep}" '.[$dep].tag' /tmp/versions.json)"
if [[ -z "${tag}" || "${tag}" == "null" ]]; then
echo "::error::Missing or null tag for '${dep}' in versions.json"
exit 1
fi
echo "longhornio/${dep}:${tag}" >> "${IMAGE_FILE}"
done
# Regenerate chart-related files
bash scripts/update-chart-readme.sh
bash scripts/update-chart-questions.sh
bash scripts/update-chart-values.sh
bash scripts/generate-longhorn-yaml.sh
# Only proceed if there are actual changes
# This prevents creating empty or duplicate PRs
if git diff --quiet; then
echo "NO_CHANGES=true" >> $GITHUB_ENV
else
echo "NO_CHANGES=false" >> $GITHUB_ENV
fi
- name: Create Pull Request
# Skip PR creation if no changes detected
if: env.NO_CHANGES == 'false'
uses: peter-evans/create-pull-request@22a9089034f40e5a961c8808d113e2c98fb63676 # v7
with:
token: ${{ steps.app-token.outputs.token }}
# Use a stable branch name so the PR is updated instead of recreated
branch: "update-deps-version-${{ env.TARGET_BRANCH }}"
delete-branch: true
sign-commits: true
signoff: true
author: Longhorn GitHub Bot <67932897+longhorn-io-github-bot@users.noreply.github.com>
committer: Longhorn GitHub Bot <67932897+longhorn-io-github-bot@users.noreply.github.com>
commit-message: "chore(chart): update dependency versions (${{ env.TARGET_BRANCH }})"
title: "chore(chart): update dependency versions (${{ env.TARGET_BRANCH }})"
body: |
This PR updates dependency versions.
Triggered by push on `${{ github.ref_name }}`.