From fb8d8ddf6060c59ec970c5dfb94783337aab3d22 Mon Sep 17 00:00:00 2001 From: karan Date: Mon, 16 Sep 2024 11:52:24 +0530 Subject: [PATCH] fixed the releases and site and setuped npm and homebrew Signed-off-by: karan --- .github/workflows/release.yml | 48 ++++++++++++++++++++++++++++++++++- Cargo.toml | 6 ++++- README.md | 5 +++- oranda.json | 14 +++++----- wix/main.wxs | 2 +- 5 files changed, 65 insertions(+), 10 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 5df0c7b..81b9d29 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: "kmj-007/homebrew-lazygh" + 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/Cargo.toml b/Cargo.toml index e50652c..4c2336b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -38,7 +38,7 @@ cargo-dist-version = "0.22.1" # CI backends to support ci = "github" # The installers to generate for each app -installers = ["shell", "powershell", "npm", "msi"] +installers = ["shell", "powershell", "npm", "homebrew", "msi"] # 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-unknown-linux-musl", "x86_64-pc-windows-msvc"] # The archive format to use for windows builds (defaults .zip) @@ -49,3 +49,7 @@ unix-archive = ".tar.gz" install-path = "CARGO_HOME" # Whether to install an updater program install-updater = true +# A GitHub repo to push Homebrew formulas to +tap = "kmj-007/homebrew-lazygh" +# Publish jobs to run in CI +publish-jobs = ["homebrew"] diff --git a/README.md b/README.md index c28d80f..b1554c2 100644 --- a/README.md +++ b/README.md @@ -34,7 +34,10 @@ If you encounter any problems or have suggestions for improvements, please open ## Roadmap -- [ ] Create a cross-platform installer(only homebrew tap is remaining) +- [ ] adding lazygh to binstall +- [ ] adding lazygh to nix-env +- [ ] adding lazygh to nix flake +- [ ] ability to maintain multiple gh config files and able to categorise them in workspace fashion but in simpler way - [ ] don't know other things to add, create an issue if you have any ideas ## Security diff --git a/oranda.json b/oranda.json index 2666fe4..7495670 100644 --- a/oranda.json +++ b/oranda.json @@ -11,6 +11,11 @@ "favicon": "https://www.axo.dev/favicon.ico" }, "marketing": { + "analytics": { + "google_analytics": { + "tracking_id": "G-TKS59X89PP" + } + }, "social": { "image": "https://www.axo.dev/meta_small.jpeg", "image_alt": "axo", @@ -22,14 +27,11 @@ "artifacts": { "package_managers": { "preferred": { - "npm": "npm install @axodotdev/oranda --save-dev", - "cargo": "cargo install oranda --locked --profile=dist" + "npm": "npm install lazygh --global", + "cargo": "cargo install lazygh" }, "additional": { - "npx": "npx @axodotdev/oranda", - "binstall": "cargo binstall oranda", - "nix-env": "nix-env -i oranda", - "nix flake": "nix profile install github:axodotdev/oranda" + "npx": "npx lazygh" } } } diff --git a/wix/main.wxs b/wix/main.wxs index 972d88d..92e2a9d 100644 --- a/wix/main.wxs +++ b/wix/main.wxs @@ -173,7 +173,7 @@ - +