Skip to content

Commit

Permalink
chore(workflow): add "update repo version file in default branch (mas…
Browse files Browse the repository at this point in the history
…ter/main)"

Longhorn 8981

Signed-off-by: Derek Su <[email protected]>
  • Loading branch information
derekbit authored and innobead committed Jul 12, 2024
1 parent 581e136 commit 95cce6b
Show file tree
Hide file tree
Showing 2 changed files with 76 additions and 0 deletions.
33 changes: 33 additions & 0 deletions .github/workflows/update-repo-version-file.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Update Longhorn Repository Version File in Default Branch (master/main)

on:
workflow_dispatch:
inputs:
version:
description: "Version, ex: v1.8.0-dev"
required: true

defaults:
run:
shell: bash

jobs:
release:
runs-on: ubuntu-latest

env:
GITHUB_TOKEN: ${{ secrets.GH_ACTION_TOKEN }}

steps:
- name: Setup Git
run: |
gh auth setup-git
- run: |
git config --global user.email "[email protected]"
git config --global user.name "David Ko"
- uses: actions/checkout@v4

- name: Update repo version files
run: ./scripts/update-repo-version-file.sh ${{ inputs.version }}
43 changes: 43 additions & 0 deletions scripts/update-repo-version-file.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
#!/usr/bin/env bash

set -o errexit
set -o xtrace

if [ "$#" -ne 1 ]; then
echo "Illegal number of arguments. version are required." >/dev/stderr
exit 1
fi

version=$1
repos_dir=.repos

repos=(
"longhorn/longhorn-manager"
"longhorn/longhorn-instance-manager"
"longhorn/longhorn-engine"
"longhorn/longhorn-share-manager"
"longhorn/backing-image-manager"
"longhorn/longhorn-ui"
"longhorn/cli"
# "longhorn/longhorn-spdk-engine" only needed since GA
)

function teardown() {
rm -rf $repos_dir
}
trap teardown EXIT

mkdir -p $repos_dir

pushd $repos_dir
for repo in "${repos[@]}"; do
gh repo clone "${repo}"

pushd "${repo##*/}"
echo ${version} > version
git add version
git commit -s -m "chore(version): update version file to ${version}"
git push -u origin HEAD
popd
done
popd

0 comments on commit 95cce6b

Please sign in to comment.