generated from LizardByte/template-base
-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c3c1c4f
commit b800f6a
Showing
6 changed files
with
191 additions
and
2 deletions.
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,56 @@ | ||
--- | ||
name: CI | ||
|
||
on: | ||
pull_request: | ||
branches: [master] | ||
types: [opened, synchronize, reopened] | ||
push: | ||
branches: [master] | ||
workflow_dispatch: | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
action: | ||
environment: | ||
${{ github.event_name == 'pull_request' && | ||
github.event.pull_request.head.repo.full_name != github.repository && | ||
'external' || 'internal' }} | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Setup Release | ||
id: setup_release | ||
uses: LizardByte/[email protected] | ||
with: | ||
fail_on_events_api_error: # PRs will fail if this is true | ||
${{ github.event_name == 'pull_request' && 'false' || 'true' }} | ||
github_token: ${{ secrets.GITHUB_TOKEN }} # can use GITHUB_TOKEN for read-only access | ||
|
||
- name: Run Action | ||
id: action | ||
uses: ./ | ||
with: | ||
git_email: ${{ secrets.GH_BOT_EMAIL }} | ||
git_username: ${{ secrets.GH_BOT_NAME }} | ||
src_root: /tests/ | ||
target_repo: ${{ github.repository }}:tests | ||
token: ${{ secrets.GH_BOT_TOKEN }} | ||
|
||
- name: Create/Update GitHub Release | ||
if: ${{ steps.setup_release.outputs.publish_release == 'true' }} | ||
uses: LizardByte/[email protected] | ||
with: | ||
allowUpdates: true | ||
body: '' | ||
discussionCategory: announcements | ||
generateReleaseNotes: true | ||
name: ${{ steps.setup_release.outputs.release_tag }} | ||
prerelease: ${{ steps.setup_release.outputs.publish_pre_release }} | ||
tag: ${{ steps.setup_release.outputs.release_tag }} | ||
token: ${{ secrets.GH_BOT_TOKEN }} |
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,2 @@ | ||
# ignore jetbrains files | ||
.idea/ |
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,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2023 LizardByte | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
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,2 +1,45 @@ | ||
# template-base | ||
Base repository template for LizardByte. | ||
# homebrew-release-action | ||
[![GitHub Workflow Status (CI)](https://img.shields.io/github/actions/workflow/status/lizardbyte/homebrew-release-action/ci.yml.svg?branch=master&label=CI%20build&logo=github&style=for-the-badge)](https://github.com/LizardByte/homebrew-release-action/actions/workflows/ci.yml?query=branch%3Amaster) | ||
|
||
A reusable action to publish homebrew formulas to a tap. | ||
This action is tailored to the @LizardByte organization, but can be used by anyone if they follow the same conventions. | ||
|
||
This is basically a wrapper around [adrianjost/files-sync-action](https://github.com/adrianjost/files-sync-action), | ||
with some different defaults to make it easier to use within the @LizardByte organization. | ||
|
||
## Basic Usage | ||
|
||
See [action.yml](action.yml) | ||
|
||
The intent here is that the formulas are build in the upstream repository, instead of the tap repository. | ||
|
||
As part of an automated release workflow, this action can be used to upload the built formulas to the tap repository. | ||
|
||
```yaml | ||
steps: | ||
- name: Publish Homebrew Formula | ||
uses: LizardByte/homebrew-release-action@master | ||
with: | ||
git_email: ${{ secrets.GIT_EMAIL }} | ||
git_username: ${{ secrets.GIT_USERNAME }} | ||
target_repo: repo_owner/repo_name | ||
token: ${{ secrets.PAT }} | ||
``` | ||
It's possible to overwrite the defaults by providing additional inputs: | ||
```yaml | ||
steps: | ||
- name: Publish Homebrew Formula | ||
uses: LizardByte/homebrew-release-action@master | ||
with: | ||
file_patterns: |- | ||
^Aliases/*$ | ||
^Formula/*.rb$ | ||
git_email: ${{ secrets.GIT_EMAIL }} | ||
git_username: ${{ secrets.GIT_USERNAME }} | ||
skip_delete: true | ||
src_root: /build/ # do not include GitHub workspace, also must end with a trailing slash | ||
target_repo: repo_owner/repo_name | ||
token: ${{ secrets.PAT }} | ||
``` |
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,46 @@ | ||
--- | ||
name: "Homebrew Release" | ||
description: "A reusable action to publish a Homebrew formula to a tap." | ||
author: "LizardByte" | ||
inputs: | ||
file_patterns: | ||
description: 'The file patterns to publish.' | ||
default: |- | ||
^Formula/*.rb$ | ||
required: false | ||
git_email: | ||
description: 'The email to use for the commit.' | ||
required: true | ||
git_username: | ||
description: 'The username to use for the commit.' | ||
required: true | ||
skip_delete: | ||
description: 'Skip deleting formulas in the target repo, that do not exist in the source repo.' | ||
default: 'false' | ||
required: false | ||
src_root: | ||
description: 'Prepend this to the file patterns.' | ||
default: '/' | ||
required: false | ||
target_repo: | ||
description: 'The target repository to publish to.' | ||
default: 'LizardByte/homebrew' | ||
required: false | ||
token: | ||
description: 'Github Token.' | ||
required: true | ||
|
||
runs: | ||
using: "composite" | ||
steps: | ||
- name: Homebrew Release | ||
uses: adrianjost/[email protected] | ||
with: | ||
COMMIT_MESSAGE: "Update ${{ github.repository }} to ${{ github.sha }}" | ||
FILE_PATTERNS: ${{ inputs.file_patterns }} | ||
GIT_EMAIL: ${{ inputs.git_email }} | ||
GIT_USERNAME: ${{ inputs.git_username }} | ||
GITHUB_TOKEN: ${{ inputs.token }} | ||
SKIP_DELETE: ${{ inputs.skip_delete }} | ||
SRC_ROOT: ${{ inputs.src_root }} | ||
TARGET_REPOS: ${{ inputs.target_repo }} |
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,21 @@ | ||
class HelloWorld < Formula | ||
desc "Simple program that outputs 'Hello, World!'" | ||
homepage "https://app.lizardbyte.devm" | ||
url "https://github.com/LizardByte/homebrew-release-action.git" | ||
version "0.0.1" | ||
|
||
def install | ||
# create hello world sh file with echo command | ||
(buildpath/"hello-world").write <<~EOS | ||
#!/bin/sh | ||
echo "Hello, World!" | ||
EOS | ||
|
||
# install the hello-world file to the bin directory | ||
bin.install "hello-world" | ||
end | ||
|
||
test do | ||
system "#{bin}/hello-world" | ||
end | ||
end |