diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 5df0c7b..390d287 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -266,14 +266,60 @@ jobs: gh release create "${{ needs.plan.outputs.tag }}" --target "$RELEASE_COMMIT" $PRERELEASE_FLAG --title "$ANNOUNCEMENT_TITLE" --notes-file "$RUNNER_TEMP/notes.txt" artifacts/* + publish-homebrew-formula: + needs: + - plan + - host + runs-on: "ubuntu-20.04" + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + PLAN: ${{ needs.plan.outputs.val }} + GITHUB_USER: "axo bot" + GITHUB_EMAIL: "admin+bot@axo.dev" + if: ${{ !fromJson(needs.plan.outputs.val).announcement_is_prerelease || fromJson(needs.plan.outputs.val).publish_prereleases }} + steps: + - uses: actions/checkout@v4 + with: + repository: "linux-china/homebrew-tap" + token: ${{ secrets.HOMEBREW_TAP_TOKEN }} + # So we have access to the formula + - name: Fetch homebrew formulae + uses: actions/download-artifact@v4 + with: + pattern: artifacts-* + path: Formula/ + merge-multiple: true + # This is extra complex because you can make your Formula name not match your app name + # so we need to find releases with a *.rb file, and publish with that filename. + - name: Commit formula files + run: | + git config --global user.name "${GITHUB_USER}" + git config --global user.email "${GITHUB_EMAIL}" + + for release in $(echo "$PLAN" | jq --compact-output '.releases[] | select([.artifacts[] | endswith(".rb")] | any)'); do + filename=$(echo "$release" | jq '.artifacts[] | select(endswith(".rb"))' --raw-output) + name=$(echo "$filename" | sed "s/\.rb$//") + version=$(echo "$release" | jq .app_version --raw-output) + + export PATH="/home/linuxbrew/.linuxbrew/bin:$PATH" + brew update + # We avoid reformatting user-provided data such as the app description and homepage. + brew style --except-cops FormulaAudit/Homepage,FormulaAudit/Desc,FormulaAuditStrict --fix "Formula/${filename}" || true + + git add "Formula/${filename}" + git commit -m "${name} ${version}" + done + git push + announce: needs: - plan - host + - publish-homebrew-formula # use "always() && ..." to allow us to wait for all publish jobs while # still allowing individual publish jobs to skip themselves (for prereleases). # "host" however must run to completion, no skipping allowed! - if: ${{ always() && needs.host.result == 'success' }} + if: ${{ always() && needs.host.result == 'success' && (needs.publish-homebrew-formula.result == 'skipped' || needs.publish-homebrew-formula.result == 'success') }} runs-on: "ubuntu-20.04" env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/CHANGELOG.md b/CHANGELOG.md index 10afa05..c7bd4c9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,7 @@ # Task Keeper Changelog -## [0.24.1] - 2024-10-05 +## [0.24.2] - 2024-10-05 - Update to gradle 8.10.1 - Add `bun.lock` support diff --git a/Cargo.toml b/Cargo.toml index bb384d8..f87c539 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "task-keeper" -version = "0.24.1" +version = "0.24.2" edition = "2021" authors = ["linux_china "] description = "Task keeper to manage tasks from different task runners" @@ -37,10 +37,10 @@ thiserror = "1" error-stack = "0.5" dotenv = "0.15" shlex = "1" -cfg-if ="1" +cfg-if = "1" uuid = { version = "1", features = ["v4"] } logos = "0.14" -shell-escape ="0.1" +shell-escape = "0.1" update-informer = { version = "1.1.0", default-features = false, features = ["github"] } [profile.release] @@ -63,7 +63,9 @@ cargo-dist-version = "0.22.1" ci = "github" # The installers to generate for each app installers = ["homebrew"] +# A GitHub repo to push Homebrew formulas to tap = "linux-china/homebrew-tap" +# Publish jobs to run in CI publish-jobs = ["homebrew"] # Target platforms to build apps for (Rust target-triple syntax) targets = ["aarch64-apple-darwin", "x86_64-apple-darwin", "x86_64-unknown-linux-gnu", "x86_64-pc-windows-msvc"] diff --git a/src/app.rs b/src/app.rs index 87a4c1c..737f3a6 100644 --- a/src/app.rs +++ b/src/app.rs @@ -1,7 +1,7 @@ //! clap App for command cli use clap::{Command, Arg, ArgAction}; -pub const VERSION: &str = "0.24.1"; +pub const VERSION: &str = "0.24.2"; pub fn build_app() -> Command { Command::new("tk")