From a6cdc18bc39fa172b8c0116824946100197009d9 Mon Sep 17 00:00:00 2001 From: Bart van der Braak Date: Wed, 8 Nov 2023 21:00:49 +0100 Subject: [PATCH 1/4] feat: add trigger deployment --- .github/workflows/trigger.yml | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 .github/workflows/trigger.yml diff --git a/.github/workflows/trigger.yml b/.github/workflows/trigger.yml new file mode 100644 index 0000000..eec709e --- /dev/null +++ b/.github/workflows/trigger.yml @@ -0,0 +1,26 @@ +name: test trigger + +on: + push: + branches: + - "feat/homebrew-releases" + pull_request: + branches: + - "main" + paths: + - ".github/workflows/trigger.yml" + +jobs: + trigger: + runs-on: ubuntu-latest + steps: + - uses: actions/github-script@v6 + with: + github-token: ${{ secrets.PAT_TOKEN }} + script: | + await github.rest.actions.createWorkflowDispatch({ + owner: 'bartvdbraak', + repo: 'homebrew-keyweave', + workflow_id: 'release.yml', + ref: 'main' + }) \ No newline at end of file From 6226f282a3e0e7ae4774e0d536e501ada001b1e0 Mon Sep 17 00:00:00 2001 From: Bart van der Braak Date: Wed, 8 Nov 2023 22:15:09 +0100 Subject: [PATCH 2/4] feat: send inputs with version and sha256sums --- .github/workflows/trigger.yml | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/.github/workflows/trigger.yml b/.github/workflows/trigger.yml index eec709e..a85ba75 100644 --- a/.github/workflows/trigger.yml +++ b/.github/workflows/trigger.yml @@ -14,6 +14,8 @@ jobs: trigger: runs-on: ubuntu-latest steps: + - id: setversion + run: echo "version=$(grep -m1 -F 'version =' Cargo.toml | cut -d\" -f2)" >> $GITHUB_OUTPUT - uses: actions/github-script@v6 with: github-token: ${{ secrets.PAT_TOKEN }} @@ -22,5 +24,14 @@ jobs: owner: 'bartvdbraak', repo: 'homebrew-keyweave', workflow_id: 'release.yml', - ref: 'main' + ref: 'main', + inputs: { + version: '${{ steps.setversion.outputs.version }}', + sha256sums: '5d486e110fed077ff9309814cc4bb205b50fa4263bad3d204e4d9f230002dd3c keyweave-aarch64-apple-darwin.tar.xz + da415340276b6bc8f700e54cafdef23445973dba0d126065cf73135dff2c922d keyweave-aarch64-unsknown-linux-gnu.tar.xz + 45863c6d3f34bb7727cd112a0adfc20b840f4f5c92def99b9e15bde20e2a32f8 keyweave-armv7-unknown-linux-gnueabihf.tar.xz + d88f646619d69f088fb2a1c223c7b1cf6199659fd593abc475851ddee866d4e9 keyweave-x86_64-apple-darwin.tar.xz + 79317c194bd41a2d9ec55e80353e3eb510a11e3c57708e65cc0a34966a86ae14 keyweave-x86_64-unknown-linux-gnu.tar.xz + 6f6ad0810a4bf75d914dd09c4c55efadc8b038d10811c4223b787ac5d1cf4186 keyweave-x86_64-unknown-linux-musl.tar.xz' + } }) \ No newline at end of file From 5fbaf26aabdcc639c60344d7f0b7007516b5fc48 Mon Sep 17 00:00:00 2001 From: Bart van der Braak Date: Wed, 8 Nov 2023 22:17:23 +0100 Subject: [PATCH 3/4] fix: sha256 file, transform and workflow dispatch --- .github/workflows/release.yml | 33 ++++++++++++++++++++++++++++--- .github/workflows/trigger.yml | 37 ----------------------------------- 2 files changed, 30 insertions(+), 40 deletions(-) delete mode 100644 .github/workflows/trigger.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 8e6a152..9a4a621 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -167,8 +167,10 @@ jobs: with: name: builds - - name: Checksums with SHA512 - run: sha512sum keyweave-* | tee SHA512SUMS + - name: Checksums with SHA512 and SHA256 + run: | + sha512sum keyweave-* | tee SHA512SUMS + sha256sum keyweave-* | tee SHA256SUMS - uses: softprops/action-gh-release@v1 env: @@ -179,4 +181,29 @@ jobs: files: | keyweave-*.tar.xz keyweave-*/keyweave.exe - *SUMS* \ No newline at end of file + *SUMS* + + - name: Create Homebrew inputs + id: homebrew-inputs + run: | + sha256sums="{$(awk '{printf "%s '\''%s'\'': '\''%s'\''", (NR>1 ? "," : ""), $2, $1} END {print ""}' SHA256SUMS)}" + echo "sha256sums=$sha256sums" >> $GITHUB_OUTPUT + echo "version=$(git describe --tags --abbrev=0)" >> $GITHUB_OUTPUT + + - uses: actions/github-script@v6 + name: Dispatch Homebrew release + with: + github-token: ${{ secrets.PAT_TOKEN }} + script: | + const sha256sums = JSON.parse('${{ steps.homebrew-inputs.outputs.sha256sums }}'); + + await github.rest.actions.createWorkflowDispatch({ + owner: 'bartvdbraak', + repo: 'homebrew-keyweave', + workflow_id: 'release.yml', + ref: 'main', + inputs: { + version: '${{ steps.homebrew-inputs.outputs.version }}', + sha256sums: JSON.stringify(sha256sums) + } + }) \ No newline at end of file diff --git a/.github/workflows/trigger.yml b/.github/workflows/trigger.yml deleted file mode 100644 index a85ba75..0000000 --- a/.github/workflows/trigger.yml +++ /dev/null @@ -1,37 +0,0 @@ -name: test trigger - -on: - push: - branches: - - "feat/homebrew-releases" - pull_request: - branches: - - "main" - paths: - - ".github/workflows/trigger.yml" - -jobs: - trigger: - runs-on: ubuntu-latest - steps: - - id: setversion - run: echo "version=$(grep -m1 -F 'version =' Cargo.toml | cut -d\" -f2)" >> $GITHUB_OUTPUT - - uses: actions/github-script@v6 - with: - github-token: ${{ secrets.PAT_TOKEN }} - script: | - await github.rest.actions.createWorkflowDispatch({ - owner: 'bartvdbraak', - repo: 'homebrew-keyweave', - workflow_id: 'release.yml', - ref: 'main', - inputs: { - version: '${{ steps.setversion.outputs.version }}', - sha256sums: '5d486e110fed077ff9309814cc4bb205b50fa4263bad3d204e4d9f230002dd3c keyweave-aarch64-apple-darwin.tar.xz - da415340276b6bc8f700e54cafdef23445973dba0d126065cf73135dff2c922d keyweave-aarch64-unsknown-linux-gnu.tar.xz - 45863c6d3f34bb7727cd112a0adfc20b840f4f5c92def99b9e15bde20e2a32f8 keyweave-armv7-unknown-linux-gnueabihf.tar.xz - d88f646619d69f088fb2a1c223c7b1cf6199659fd593abc475851ddee866d4e9 keyweave-x86_64-apple-darwin.tar.xz - 79317c194bd41a2d9ec55e80353e3eb510a11e3c57708e65cc0a34966a86ae14 keyweave-x86_64-unknown-linux-gnu.tar.xz - 6f6ad0810a4bf75d914dd09c4c55efadc8b038d10811c4223b787ac5d1cf4186 keyweave-x86_64-unknown-linux-musl.tar.xz' - } - }) \ No newline at end of file From 2d4a74e6c4c2b4fe069e2f2c00563237504cec5a Mon Sep 17 00:00:00 2001 From: Bart van der Braak Date: Thu, 9 Nov 2023 00:38:55 +0100 Subject: [PATCH 4/4] docs: add instructions for installation --- README.md | 46 ++++++++++++++++++++++++++++++++++------------ 1 file changed, 34 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index a0a6308..f1ee98e 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ Cluster -Keyweave is an open-source tool designed to seamlessly fetch secrets from Azure Key Vault and weave them into a convenient `.env` file. Developed in Rust, Keyweave is efficient and easy to use, making it an ideal choice for managing your application's secrets. +Keyweave is an open-source tool crafted to seamlessly fetch secrets from Azure Key Vault and weave them into a convenient `.env` file. Developed in Rust, Keyweave stands out for its efficiency and user-friendly design, making it an ideal choice for managing your application's secrets. ## Features @@ -13,30 +13,52 @@ Keyweave is an open-source tool designed to seamlessly fetch secrets from Azure ## Prerequisites -- **Rust**: Ensure you have Rust installed on your system. If not, you can install it using [rustup](https://rustup.rs/). -- **Azure Account**: Log into your Azure tenant and set up the right subscription. +Before diving into Keyweave, ensure you have the following prerequisites: -## Installation +- **Azure Account**: Log into your Azure tenant and set up the right subscription, along with any Access Policies required for you to read and list secrets from your Key Vault. -Clone the repository to your local machine: +```sh +az login --tenant "your-tenant-guid" +az account set --subscription "your-subscription-guid" +``` + +## Installation (MacOS, Linux) + +For MacOS and Linux systems, installation is a breeze with [Homebrew](https://brew.sh/). Simply run: + +```bash +brew tap bartvdbraak/keyweave +brew install keyweave +``` + +## Manual Download + +If you prefer manual installation or need binaries for different platforms (including an executable for Windows), visit the [Releases](/releases) page of this GitHub repository. + +## Building from Source + +Keyweave is built with [Cargo](https://doc.rust-lang.org/cargo/), the Rust package manager. + +To build Keyweave from source, follow these steps: ```sh git clone https://github.com/bartvdbraak/keyweave.git cd keyweave +cargo build --release ``` -Build the project: +Once built, run Keyweave using Cargo: ```sh -cargo build --release +cargo run -- --vault_name [--output ] [--filter ] ``` ## Usage -After building the project, you can run Keyweave using the following command: +With the binary on your `PATH`, run Keyweave as follows: ```sh -cargo run -- --vault_name [--output ] [--filter ] +keyweave --vault_name [--output ] [--filter ] ``` - `--vault_name `: Sets the name of the Azure Key Vault. @@ -46,13 +68,13 @@ cargo run -- --vault_name [--output ] [--filter ] ## Example ```sh -cargo run -- --vault_name my-key-vault --output my-env-file.env --filter my-secret +keyweave --vault_name my-key-vault --output my-env-file.env --filter my-secret ``` ## License -Keyweave is licensed under the GLPv3 License. See [LICENSE](LICENSE) for more details. +Keyweave is licensed under the GPLv3 License. See [LICENSE](LICENSE) for more details. ## Contributing -We welcome contributions! Please feel free to submit pull requests, report issues, or suggest new features. +We welcome contributions! Feel free to submit pull requests, report issues, or suggest new features. Your input helps make Keyweave even better.