Skip to content

Update hkubectl download files via workflow when hkubectl updates #3

Update hkubectl download files via workflow when hkubectl updates

Update hkubectl download files via workflow when hkubectl updates #3

name: Update Download Files from hkubectl Release
# Trigger the workflow when a new release is published in the hkubectl repository
on:
# Triggers the workflow on push or pull request events but only for the master branch.
pull_request:
branches: [ source ]
jobs:
update-files:
runs-on: ubuntu-latest
steps:
- name: Checkout kube-HPC.github.io repository
uses: actions/checkout@v2
with:
repository: kube-HPC/kube-HPC.github.io
ref: source
- name: Download latest release files from hkubectl
run: |
export latestVersion=$(curl -s https://api.github.com/repos/kube-HPC/hkubectl/releases/latest | jq -r .tag_name)
mkdir -p site/hkubectl_files || { echo "Failed to create directory"; exit 1; }
curl -L --retry 3 --retry-delay 5 https://github.com/kube-HPC/hkubectl/releases/download/${latestVersion}/hkubectl-linux -o site/hkubectl_files/hkubectl-linux
curl -L --retry 3 --retry-delay 5 https://github.com/kube-HPC/hkubectl/releases/download/${latestVersion}/hkubectl-macos -o site/hkubectl_files/hkubectl-macos
curl -L --retry 3 --retry-delay 5 https://github.com/kube-HPC/hkubectl/releases/download/${latestVersion}/hkubectl-win.exe -o site/hkubectl_files/hkubectl-win.exe
- name: Commit and push updated files to kube-HPC.github.io
run: |
git config --global user.name "GitHub Actions"
git config --global user.email "[email protected]"
git add hkubectl_files/*
git commit -m "Update hkubectl download files to the latest release" || echo "No changes to commit"
git push origin main