Skip to content

Commit

Permalink
try to update homebrew recipe of btmeister from CI
Browse files Browse the repository at this point in the history
  • Loading branch information
tamada committed Jun 19, 2022
1 parent b64a404 commit fbcd555
Show file tree
Hide file tree
Showing 10 changed files with 241 additions and 101 deletions.
48 changes: 48 additions & 0 deletions .github/workflows/homebrew.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: homebrew

on:
workflow_run:
workflows:
- "publish_site_release_assets"
types:
- completed

jobs:
build_and_push:
runs-on: macos-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
repository: 'tamada/homebrew-brew'

- name: Git Tag name
id: vars
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
tag=$(gh release view --json tagName --jq .tagName)
echo "::set-output name=tag::${tag##v}"
- name: Setup Git
run: |
git config --global user.name "GitHub Actions"
git config --global user.email "action@github.com"
auth_header="$(git config --local --get http.https://github.com/.extraheader)"
- name: Update btmeister.rb
run: |
VERSION=${{ steps.vars.outputs.tag }}
curl -o btmeister.tar.gz -L https://github.com/tamada/btmeister/releases/download/v${VERSION}/btmeister-${VERSION}_darwin_amd64.tar.gz
sha256=$(shasum -a 256 btmeister.tar.gz)
sed 's/VERSION = \".*\"/VERSION = \"${{ steps.vars.outputs.tag }}\"' Formula/btmeister.rb > a
sed "s/ sha256 \".*\"/ sha256 \"${sha256}\"" a > b
mv b Formula/btmeister.rb
git commit -a -m "update btmeister version to ${{ steps.vars.outputs.tag }}"
- name: Push branch
uses: ad-m/github-push-action@master
with:
repository: "tamada/homebrew-brew"
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: master
3 changes: 1 addition & 2 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@ jobs:
- name: Git Tag name
id: vars
run: |
# HEAD_REF=${{ github.head_ref }}
echo $GITHUB_HEAD_REF
echo "GITHUB_HEAD_REF: $GITHUB_HEAD_REF (${GITHUB_HEAD_REF##*/v})"
echo "::set-output name=tag::${GITHUB_HEAD_REF##*/v}"
- name: Create release
Expand Down
9 changes: 7 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ This tool finds the build files from the specified directories, and identifies t
## :runner: Usage

```sh
btmeister 0.1.0
btmeister v0.3.21
Haruaki TAMADA
A tool for detecting build tools in use of the projects

Expand Down Expand Up @@ -79,9 +79,14 @@ $ btmeister --format json . ~/go/src/github.com/tamada/rrh | jq .
## :whale: Docker
```sh
docker run --rm -it tamada/btmeister
docker run --rm -it -v $PWD:/home/btmeister ghcr.io/tamada/btmeister:latest .
```
* Container OS
* Working directory: `/home/btmeister`
* entry point: `/opt/btmeister/btmeister`
* user: `btmeister`
## :hammer_and_wrench: Related Tools
Expand Down
6 changes: 3 additions & 3 deletions build.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use clap::{Command, IntoApp};
use clap_complete::Shell;
use clap::{IntoApp, Command};
use std::path::Path;
use std::fs::File;
use std::path::Path;

include!("src/cli.rs");

Expand All @@ -25,4 +25,4 @@ fn main() {
generate(Shell::Fish, &mut app, &outdir, "fish/btmeister");
generate(Shell::PowerShell, &mut app, &outdir, "powershell/btmeister");
generate(Shell::Zsh, &mut app, &outdir, "zsh/_btmeister");
}
}
2 changes: 1 addition & 1 deletion site/content/about.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ title: ":smile: About"

The logo of btmeister is as follows.

![btmeister_logo](https://raw.githubusercontent.com/tamada/btmeister/main/site/images/logo.png)
![btmeister_logo](https://raw.githubusercontent.com/tamada/btmeister/main/site/static/images/logo.png)

This image is refered from [freesvg.org](https://freesvg.org/worker-with-tool) by [OpenClipart](https://freesvg.org/by/OpenClipart).

Expand Down
1 change: 0 additions & 1 deletion site/content/install.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,3 @@ $ cargo build --release

Then, `cargo` build the resultant `btmeister` executable on `target/release` directory.


7 changes: 3 additions & 4 deletions src/btmeister.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
use rust_embed::RustEmbed;
use serde::{Deserialize, Serialize};
use std::fs::OpenOptions;
use std::io::BufReader;
use std::path::PathBuf;
use rust_embed::RustEmbed;

#[derive(RustEmbed)]
#[folder = "defs"]
Expand Down Expand Up @@ -64,7 +64,7 @@ pub fn construct(
Ok(result)
}

#[cfg(test)]
#[cfg(test)]
mod test {
use super::*;

Expand All @@ -83,7 +83,7 @@ mod test {
assert!(r.is_ok());
if let Ok(result) = r {
assert_eq!(2, result.len());
}
}
}

#[test]
Expand Down Expand Up @@ -113,4 +113,3 @@ mod test {
}
}
}

11 changes: 9 additions & 2 deletions src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,17 @@ pub struct Options {
)]
pub format: Format,

#[clap(short = 'L', long = "list-defs", help = "Print the build tools' definition list")]
#[clap(
short = 'L',
long = "list-defs",
help = "Print the build tools' definition list"
)]
pub list_defs: bool,

#[clap(long = "no-ignore", help = "Do not respect ignore files (.ignore, .gitignore, etc.)")]
#[clap(
long = "no-ignore",
help = "Do not respect ignore files (.ignore, .gitignore, etc.)"
)]
pub no_ignore: bool,

#[clap(
Expand Down
Loading

0 comments on commit fbcd555

Please sign in to comment.