-
Notifications
You must be signed in to change notification settings - Fork 4
145 lines (141 loc) · 4.44 KB
/
update-casks.yml
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
---
name: Update Casks
concurrency: jimeh/homebrew-emacs-builds/update-casks
on:
schedule:
- cron: "0 15 * * *"
workflow_dispatch:
inputs:
cask:
description: "Specific cask to update (all if empty)"
required: false
default: ""
extraArgs:
description: "Extra arguments passed to emacs-builder cask update"
required: false
default: ""
jobs:
emacs-builder:
runs-on: macos-12
steps:
- name: Checkout build-emacs-for-macos repo
uses: actions/checkout@v4
with:
repository: jimeh/build-emacs-for-macos
ref: "v0.6.45"
- name: Install Go
uses: actions/setup-go@v5
with:
go-version: "1.21"
- name: Build emacs-builder tool
run: make build
- name: Upload emacs-builder artifact
uses: actions/upload-artifact@v4
with:
name: emacs-builder
path: bin/emacs-builder
if-no-files-found: error
live-check:
runs-on: macos-12
outputs:
tap_sha: ${{ steps.tap_sha.outputs.sha }}
steps:
- name: Checkout tap repository
uses: actions/checkout@v4
with:
ref: main
path: tap
- name: Store tap Git SHA
id: tap_sha
run: |
echo "sha=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT
- name: Symlink homebrew tap
run: |
mkdir -p "$(brew --repo)/Library/Taps/jimeh"
ln -s "${{ github.workspace }}/tap" \
"$(brew --repo)/Library/Taps/jimeh/homebrew-emacs-builds"
- name: brew livecheck (all casks)
if: ${{ github.event.inputs.cask == '' }}
run: >-
brew livecheck --json --quiet --tap jimeh/emacs-builds
| tee livecheck-results.json
- name: brew livecheck (specific cask)
if: ${{ github.event.inputs.cask != '' }}
run: >-
brew livecheck --json --quiet
jimeh/emacs-builds/${{ github.event.inputs.cask }}
| tee livecheck-results.json
- name: Upload livecheck-results.json artifact
uses: actions/upload-artifact@v4
with:
name: livecheck-results.json
path: livecheck-results.json
if-no-files-found: error
update-casks:
runs-on: macos-12
needs: [emacs-builder, live-check]
steps:
- name: Checkout tap repository
uses: actions/checkout@v4
with:
ref: ${{ needs.live-check.outputs.tap_sha }}
path: tap
- name: Download pre-built emacs-builder artifact
uses: actions/download-artifact@v4
with:
name: emacs-builder
path: bin
- name: Ensure emacs-builder is executable
run: chmod +x bin/emacs-builder
- name: Download livecheck-results.json artifact
uses: actions/download-artifact@v4
with:
name: livecheck-results.json
path: ./
- name: Update casks
run: >-
bin/emacs-builder
cask --builds-repository jimeh/emacs-builds
update --templates-dir tap/templates
${{ github.event.inputs.extraArgs }}
livecheck-results.json
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
update-meta:
runs-on: macos-12
needs: [update-casks]
permissions:
contents: write
steps:
- name: Checkout tap repository main branch
uses: actions/checkout@v4
with:
ref: main
path: tap
- name: Symlink homebrew tap
run: |
mkdir -p "$(brew --repo)/Library/Taps/jimeh"
ln -s "${{ github.workspace }}/tap" \
"$(brew --repo)/Library/Taps/jimeh/homebrew-emacs-builds"
- name: Checkout tap repository meta branch
uses: actions/checkout@v4
with:
ref: meta
path: meta
- name: Install meta dependencies
run: brew bundle
working-directory: meta
- name: Update meta files
run: make update
working-directory: meta
- name: commit and push changes to meta branch
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: "chore(meta): update meta files"
repository: meta
branch: meta
commit_user_name: github-actions[bot]
commit_user_email: github-actions[bot]@users.noreply.github.com
commit_author: >-
github-actions[bot] <github-actions[bot]@users.noreply.github.com>
skip_dirty_check: false