-
Notifications
You must be signed in to change notification settings - Fork 0
38 lines (36 loc) · 1.35 KB
/
update.yml
File metadata and controls
38 lines (36 loc) · 1.35 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
on:
repository_dispatch:
types: [update]
workflow_dispatch:
inputs:
version:
description: 'Version (e.g., v0.3.0)'
required: true
type: string
sha256:
description: 'SHA256 hash of the release asset'
required: true
type: string
permissions:
contents: write
jobs:
update:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- name: Modify a Cask
run: |
VERSION="${{ github.event.inputs.version || github.event.client_payload.version }}"
SHA256="${{ github.event.inputs.sha256 || github.event.client_payload.sha256 }}"
VERSION_NO_V="${VERSION#v}"
sed -i "s/version \"[0-9]\+\.[0-9]\+\.[0-9]\+\"/version \"${VERSION_NO_V}\"/; s/sha256 \"[0-9a-f]\{64\}\"/sha256 \"${SHA256}\"/" Casks/arto.rb
- name: Commit & Push
# https://github.com/actions/checkout/blob/main/README.md#push-a-commit-using-the-built-in-token
run: |
if [ -n "$(git diff --name-only Casks/arto.rb)" ]; then
git add --update
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git commit -m "Update Cask for version ${{ github.event.inputs.version || github.event.client_payload.version }}"
git push
fi