forked from Homebrew/homebrew-cask
-
Notifications
You must be signed in to change notification settings - Fork 0
117 lines (101 loc) · 4.45 KB
/
publish-commit-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
name: Publish and commit casks
on:
workflow_dispatch:
inputs:
pull_request:
description: Pull request number
required: true
args:
description: "Extra arguments to `brew pr-pull`"
default: ""
env:
GNUPGHOME: /tmp/gnupghome
HOMEBREW_DEVELOPER: 1
HOMEBREW_NO_AUTO_UPDATE: 1
permissions:
contents: read
jobs:
upload:
runs-on: 'ubuntu-latest'
steps:
- name: Post comment once started
uses: Homebrew/actions/post-comment@master
with:
token: ${{secrets.HOMEBREW_GITHUB_PUBLIC_REPO_TOKEN}}
issue: ${{github.event.inputs.pull_request}}
body: ":shipit: @${{github.actor}} has [triggered a merge](${{github.event.repository.html_url}}/actions/runs/${{github.run_id}})."
bot_body: ":robot: A scheduled task has [triggered a merge](${{github.event.repository.html_url}}/actions/runs/${{github.run_id}})."
bot: BrewTestBot
- name: Set up Homebrew
id: set-up-homebrew
uses: Homebrew/actions/setup-homebrew@master
with:
test-bot: false
# Workaround until the `cache` action uses the changes from
# https://github.com/actions/toolkit/pull/580.
- name: Unlink workspace
if: github.event.inputs.self_hosted != 'true'
run: |
mv "${GITHUB_WORKSPACE}" "${GITHUB_WORKSPACE}-link"
mkdir "${GITHUB_WORKSPACE}"
- name: Cache gems
if: github.event.inputs.self_hosted != 'true'
uses: actions/cache@v2
with:
path: ${{steps.set-up-homebrew.outputs.gems-path}}
key: ${{runner.os}}-rubygems-v2-${{steps.set-up-homebrew.outputs.gems-hash}}
restore-keys: ${{runner.os}}-rubygems-v2-
# Workaround until the `cache` action uses the changes from
# https://github.com/actions/toolkit/pull/580.
- name: Re-link workspace
if: github.event.inputs.self_hosted != 'true'
run: |
rmdir "${GITHUB_WORKSPACE}"
mv "${GITHUB_WORKSPACE}-link" "${GITHUB_WORKSPACE}"
- name: Install gems
if: github.event.inputs.self_hosted != 'true'
run: brew install-bundler-gems
- name: Configure Git user
uses: Homebrew/actions/git-user-config@master
- name: Set up commit signing
uses: Homebrew/actions/setup-commit-signing@master
with:
signing_key: ${{ secrets.BREWTESTBOT_GPG_SIGNING_SUBKEY }}
- name: Pull and squash commits
env:
BREWTESTBOT_NAME_EMAIL: "BrewTestBot <[email protected]>"
HOMEBREW_GPG_PASSPHRASE: ${{ secrets.BREWTESTBOT_GPG_SIGNING_SUBKEY_PASSPHRASE }}
HOMEBREW_GITHUB_API_TOKEN: ${{secrets.HOMEBREW_CASK_PUBLIC_REPO_EMAIL_TOKEN}}
run: brew pr-pull --debug --workflows=ci.yml --committer="$BREWTESTBOT_NAME_EMAIL" --tap homebrew/cask ${{github.event.inputs.args}} ${{github.event.inputs.pull_request}}
- name: Push commits
uses: Homebrew/actions/git-try-push@master
with:
token: ${{secrets.HOMEBREW_GITHUB_PUBLIC_REPO_TOKEN}}
directory: /home/linuxbrew/.linuxbrew/Homebrew/Library/Taps/homebrew/homebrew-cask
env:
GIT_COMMITTER_NAME: BrewTestBot
GIT_COMMITTER_EMAIL: [email protected]
HOMEBREW_GPG_PASSPHRASE: ${{ secrets.BREWTESTBOT_GPG_SIGNING_SUBKEY_PASSPHRASE }}
- name: Post comment on failure
if: ${{!success()}}
uses: Homebrew/actions/post-comment@master
with:
token: ${{secrets.HOMEBREW_GITHUB_PUBLIC_REPO_TOKEN}}
issue: ${{github.event.inputs.pull_request}}
body: ":warning: @${{github.actor}} merge [failed](${{github.event.repository.html_url}}/actions/runs/${{github.run_id}})."
bot_body: ":warning: Publish [failed](${{github.event.repository.html_url}}/actions/runs/${{github.run_id}})."
bot: BrewTestBot
- name: Dismiss approvals on failure
if: ${{!success()}}
uses: Homebrew/actions/dismiss-approvals@master
with:
token: ${{secrets.HOMEBREW_GITHUB_PUBLIC_REPO_TOKEN}}
pr: ${{github.event.inputs.pull_request}}
message: "merge failed"
# Workaround until the `cache` action uses the changes from
# https://github.com/actions/toolkit/pull/580.
- name: Unlink workspace
if: github.event.inputs.self_hosted != 'true'
run: |
rm "${GITHUB_WORKSPACE}"
mkdir "${GITHUB_WORKSPACE}"