Skip to content

Commit ef32c4d

Browse files
committed
updating the sha of the current package
1 parent b08cee9 commit ef32c4d

File tree

1 file changed

+16
-9
lines changed

1 file changed

+16
-9
lines changed

.github/workflows/update-brew-package.yml

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ on:
77
description: "anything you'd like recorded for this workflow run"
88
required: false
99
type: "string"
10-
default: "manually run workflow"
10+
default: "user manually triggered workflow"
1111

1212
permissions:
1313
contents: write
@@ -26,19 +26,26 @@ jobs:
2626
run: |
2727
echo "tag=`echo $(git describe --tags --abbrev=0)`"
2828
echo "tag=`echo $(git describe --tags --abbrev=0)`" >> "$GITHUB_OUTPUT"
29+
2930
- name: Get upstream release
3031
id: upstreamRelease
3132
uses: pozetroninc/github-action-get-latest-release@master
3233
with:
3334
repository: small-hack/smol-k8s-lab
3435

35-
- name: Update Release
36+
- name: Update Release Version
3637
run: |
37-
sed -i 's/${{ steps.localTag.outputs.tag }}/${{ steps.upstreamRelease.outputs.release }}/g' ./Formula/smol-k8s-lab.rb
38-
cat ./Formula/smol-k8s-lab.rb
39-
git config --global user.email "jessebot@linux.com"
40-
git config --global user.name "jessebot"
41-
git commit -m "Updating latest package from ${{ steps.localTag.outputs.tag }} to ${{ steps.upstreamRelease.outputs.release }}" ./Formula/smol-k8s-lab.rb
42-
git push
38+
echo "replacing latest version"
39+
sed -i 's/${{ steps.localTag.outputs.tag }}/${{ steps.upstreamRelease.outputs.release }}/g' ./Formula/smol-k8s-lab.rb && cat ./Formula/smol-k8s-lab.rb
40+
41+
echo "replacing the sha of old version with new version"
42+
curl -O https://github.com/small-hack/smol-k8s-lab/archive/refs/tags/${{ steps.upstreamRelease.outputs.release }}.tar.gz
43+
echo "sha=$(shasum -a 256 ${{ steps.upstreamRelease.outputs.release }}.tar.gz | cut -d ' ' -f 1)" >> $GITHUB_ENV
44+
echo "old_sha=$(grep sha ./Formula/smol-k8s-lab.rb | awk -F ' ' '{print $2}' | sed 's/"//g')" >> $GITHUB_ENV
45+
sed -i 's/${{ env.old_sha }}/${{ env.sha }}/' ./Formula/smol-k8s-lab.rb && grep sha ./Formula/smol-k8s-lab.rb
46+
47+
echo "tagging and pushing to main branch"
4348
git tag ${{ steps.upstreamRelease.outputs.release }}
44-
git push --tags
49+
git config --global user.email "jessebot@linux.com" && git config --global user.name "jessebot"
50+
git commit -m "Updating latest package from ${{ steps.localTag.outputs.tag }} to ${{ steps.upstreamRelease.outputs.release }}" ./Formula/smol-k8s-lab.rb
51+
git push && git push --tags

0 commit comments

Comments
 (0)