-
-
Notifications
You must be signed in to change notification settings - Fork 0
54 lines (45 loc) · 1.55 KB
/
Copy pathupdate-formula.yml
File metadata and controls
54 lines (45 loc) · 1.55 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
name: Update Formula
on:
repository_dispatch:
types: [update-formula]
workflow_dispatch:
jobs:
update-formula:
runs-on: ubuntu-latest
timeout-minutes: 5
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- name: Fetch latest version from JSR
id: version
run: |
VERSION=$(curl -fsSL "https://jsr.io/@probitas/probitas/meta.json" | jq -r '.latest')
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
echo "Latest version: $VERSION"
- name: Update Formula version
run: |
# Update version in Formula
sed -i 's/version "[^"]*"/version "${{ steps.version.outputs.version }}"/' Formula/probitas.rb
# Show the change
echo "Updated Formula:"
grep 'version "' Formula/probitas.rb
- name: Check for changes
id: changes
run: |
if git diff --quiet Formula/probitas.rb; then
echo "changed=false" >> "$GITHUB_OUTPUT"
echo "No changes detected"
else
echo "changed=true" >> "$GITHUB_OUTPUT"
echo "Changes detected"
git diff Formula/probitas.rb
fi
- name: Commit and push
if: steps.changes.outputs.changed == 'true'
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add Formula/probitas.rb
git commit -m "Update probitas formula to ${{ steps.version.outputs.version }}"
git push