Skip to content

app: Bump version to 0.28.0 #36

app: Bump version to 0.28.0

app: Bump version to 0.28.0 #36

name: PR to update homebrew
# This action will run after a tag starting with "v" is published
on:
push:
tags:
- 'v*'
workflow_dispatch:
env:
LATEST_HEADLAMP_TAG: latest
permissions:
contents: read
jobs:
create_pr_to_upgrade_homebrew:
name: Create PR to upgrade homebrew
runs-on: ubuntu-latest
permissions:
contents: write # needed to push a branch
pull-requests: write # needed to open a pull request
steps:
- name: Checkout headlamp repo
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
with:
path: headlamp
fetch-depth: 0
- name: Configure Git
run: |
user=${{github.actor}}
if [ -z $user ]; then
user=yolossn
fi
git config --global user.name "$user"
git config --global user.email "$user@users.noreply.github.com"
- name: Get headlamp latest tag
run: |
cd headlamp
latestTag=$(git tag --list --sort=version:refname 'v*' | tail -1)
echo "LATEST_HEADLAMP_TAG=$latestTag" >> $GITHUB_ENV
echo $latestTag
- name: Sync homebrew-cask fork from upstream
run: |
gh repo sync headlamp-k8s/homebrew-cask
env:
GITHUB_TOKEN: ${{ secrets.KINVOLK_REPOS_TOKEN }}
- name: Check out homebrew-cask repo
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
with:
repository: headlamp-k8s/homebrew-cask
path: homebrew-cask
token: ${{ secrets.KINVOLK_REPOS_TOKEN }}
fetch-depth: 0
- name: Update headlamp version in homebrew-cask
run: |
user=${{github.actor}}
HEADLAMP_VERSION=${LATEST_HEADLAMP_TAG:1}
if [ -z $user ]; then
user=yolossn
fi
cd homebrew-cask
if git branch -l | grep -q "update_headlamp_$HEADLAMP_VERSION"; then
echo "deleting old branch from local to avoid conflict"
git branch -D "update_headlamp_$HEADLAMP_VERSION"
fi
if git branch -a | grep -q "origin/update_headlamp_$HEADLAMP_VERSION"; then
echo "deleting old branch from remote to avoid conflict"
git push origin --delete "update_headlamp_$HEADLAMP_VERSION"
fi
wget "https://github.com/headlamp-k8s/headlamp/releases/download/$LATEST_HEADLAMP_TAG/checksums.txt"
ARM_SHA=$(cat checksums.txt | grep .arm64.dmg | awk -F" " '{print $1}')
INTEL_SHA=$(cat checksums.txt | grep .x64.dmg | awk -F" " '{print $1}')
git checkout -b "update_headlamp_$HEADLAMP_VERSION"
sed -i "s/version\ .*/version \"$HEADLAMP_VERSION\"/g" ./Casks/h/headlamp.rb
if [ $ARM_SHA ]; then
echo "replacing ARM SHA"
sed -i "s/sha256 arm:\ \".*/sha256 arm:\ \"$ARM_SHA\",/g" ./Casks/h/headlamp.rb
fi
if [ $INTEL_SHA ]; then
echo "replacing Intel SHA"
sed -i "s/ intel:\ \".*/ intel:\ \"$INTEL_SHA\"/g" ./Casks/h/headlamp.rb
fi
git diff
rm ./checksums.txt
git add ./Casks/h/headlamp.rb
git status
git commit --signoff -m "Update Headlamp version to $HEADLAMP_VERSION"
git status
git log -1
git push origin "update_headlamp_$HEADLAMP_VERSION" -f
gh pr create \
--title "Upgrade Headlamp version to $HEADLAMP_VERSION" \
--repo "Homebrew/homebrew-cask" \
--head "headlamp-k8s:update_headlamp_$HEADLAMP_VERSION" \
--base "master" \
--assignee "$user" \
--body "Upgrade Headlamp version to $HEADLAMP_VERSION
cc: @$user" \
env:
LATEST_HEADLAMP_TAG: ${{ env.LATEST_HEADLAMP_TAG }}
GITHUB_TOKEN: ${{ secrets.KINVOLK_REPOS_TOKEN }}