-
Notifications
You must be signed in to change notification settings - Fork 43
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix brew-update util, and add CI #207
Open
danielbayley
wants to merge
6
commits into
yaml:devel
Choose a base branch
from
danielbayley:main
base: devel
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+63
−21
Open
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
f8354ab
util: Change A to atom
ingydotnet cc33acc
release: Revert recent changes to release scripts
ingydotnet ed5a5a7
util: Fix brew-update cross-platform
danielbayley c96623b
util: Fix brew-url
danielbayley 51a9e87
util: Refactor brew-update cross-platform
danielbayley d0f44c3
ci: Add Homebrew update
danielbayley File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
name: Update Homebrew Formulae | ||
on: | ||
release: | ||
types: [released] | ||
|
||
workflow_dispatch: | ||
push: | ||
branches: [main] | ||
paths: | ||
- .github/workflows/brew-update.yaml | ||
|
||
jobs: | ||
Update: | ||
runs-on: macos-latest | ||
steps: | ||
- name: Tap | ||
run: | | ||
brew tap ${{ github.repository_owner }}/yamlscript | ||
brew install ys | ||
|
||
- name: Livecheck | ||
id: livecheck | ||
env: | ||
HOMEBREW_GITHUB_API_TOKEN: ${{ github.token }} | ||
run: | | ||
brew livecheck --newer-only --quiet --json ys | | ||
jq --raw-output '"version=\(.[].version.latest)"' >> $GITHUB_OUTPUT | ||
|
||
- name: Checkout | ||
if: steps.livecheck.outputs.version != '' | ||
uses: actions/checkout@v4 | ||
|
||
- name: Configure Git | ||
if: steps.livecheck.outputs.version != '' | ||
run: | | ||
git config --global user.name ${{ github.repository_owner }} | ||
git config --global user.email ${{ github.event.pusher.email }} | ||
|
||
- name: Bump Version | ||
if: steps.livecheck.outputs.version != '' | ||
env: | ||
version: ${{ steps.livecheck.outputs.version }} | ||
GH_TOKEN: ${{ secrets.ACCESS_TOKEN }} | ||
run: | | ||
util/brew-update $version | ||
cd homebrew-yamlscript | ||
gh auth setup-git | ||
git add --all | ||
git commit --message "Update $version" | ||
git push |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,22 @@ | ||
#!/usr/bin/env ys-0 | ||
|
||
releases-url =: 'https://github.com/yaml/yamlscript/releases' | ||
brew-url =: '[email protected]:yaml/homebrew-yamlscript' | ||
repo =: ENV.GITHUB_REPOSITORY_OWNER || 'yaml' | ||
brew-url =: "https://github.com/$repo/homebrew-yamlscript" | ||
|
||
defn main(version): | ||
check-version: version | ||
download-releases: version | ||
update-brew: version | ||
|
||
os =: System/getProperty('os.name') | ||
|
||
defn sha256sum(file): | ||
sh: | ||
if os =~ /Mac\s?OS/: | ||
then: "shasum -a 256 $file" | ||
else: "sha256sum $file" | ||
|
||
defn update-brew(version): | ||
releases =: releases(version) | ||
|
||
|
@@ -22,7 +31,7 @@ defn update-brew(version): | |
text =: | ||
reduce-kv _ text releases: | ||
fn(text key file): | ||
sha256 =: sh("sha256sum $file").out:words.0 | ||
sha256 =: sha256sum(file).out:words.0 | ||
text: .replace(key sha256) | ||
|
||
say: "Updating homebrew-yamlscript/ys.rb" | ||
|
@@ -51,9 +60,7 @@ defn download-releases(version): | |
when-not fs-e(file): | ||
say: "Downloading $file" | ||
url =: "$releases-url/download/$version/$file" | ||
res =: sh("wget -q $url") | ||
when res.exit:N.?: | ||
die: "Download of '$url' failed:\n$(res.err)" | ||
spit file: curl(url) | ||
|
||
defn releases(version):: | ||
LIN_ARM:: "ys-${version}-linux-aarch64.tar.xz" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I love to see you refactoring with YS code!