diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index d6dca37..d602ebf 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -390,117 +390,8 @@ jobs: run: | echo "Release version: ${{ env.RELEASE_VERSION }}" -# - name: Check if winget package already exists -# id: check -# shell: bash -# env: -# IDENTIFIER: DarkAlex17.GMan -# run: | -# set -euo pipefail -# publisher=${IDENTIFIER%%.*} -# pkgname=${IDENTIFIER#*.} -# first_letter=${publisher:0:1} -# api_url="https://api.github.com/repos/microsoft/winget-pkgs/contents/manifests/$first_letter/$publisher/$pkgname" -# status=$(curl -s -o /dev/null -w "%{http_code}" "$api_url") -# if [[ "$status" == "200" ]]; then -# echo "exists=true" >> "$GITHUB_OUTPUT" -# else -# echo "exists=false" >> "$GITHUB_OUTPUT" -# fi -# -# - name: Prepare manifests for first submission -# if: steps.check.outputs.exists == 'false' && env.ACT != 'true' -# shell: bash -# env: -# IDENTIFIER: DarkAlex17.GMan -# RELEASE_VERSION: ${{ env.RELEASE_VERSION }} -# REPO: ${{ github.repository }} -# run: | -# set -euo pipefail -# publisher=${IDENTIFIER%%.*} -# pkgname=${IDENTIFIER#*.} -# desc="$(grep -m1 '^description\s*=\s*"' Cargo.toml | sed -E 's/^[^\"]+\"(.*)\"/\1/')" -# license="$(grep -m1 '^license\s*=\s*"' Cargo.toml | sed -E 's/^[^\"]+\"(.*)\"/\1/')" -# -# # Compute SHAs from artifacts -# x64_sha=$(awk '{print $1}' artifacts/gman-x86_64-pc-windows-msvc.sha256) -# arm64_sha=$(awk '{print $1}' artifacts/gman-aarch64-pc-windows-msvc.sha256) -# -# # Release URLs -# url_x64="https://github.com/$REPO/releases/download/v$RELEASE_VERSION/gman-x86_64-pc-windows-msvc.zip" -# url_arm64="https://github.com/$REPO/releases/download/v$RELEASE_VERSION/gman-aarch64-pc-windows-msvc.zip" -# -# # Create temporary manifest directory -# root="winget-manifests/manifests/${publisher:0:1}/$publisher/$pkgname/$RELEASE_VERSION" -# mkdir -p "$root" -# -# echo "PackageIdentifier: $IDENTIFIER" >> "$root/$IDENTIFIER.yaml" -# echo "PackageVersion: $RELEASE_VERSION" >> "$root/$IDENTIFIER.yaml" -# echo "DefaultLocale: en-US" >> "$root/$IDENTIFIER.yaml" -# echo "ManifestType: version" >> "$root/$IDENTIFIER.yaml" -# echo "ManifestVersion: 1.10.0" >> "$root/$IDENTIFIER.yaml" -# -# echo "PackageIdentifier: $IDENTIFIER" >> "$root/$IDENTIFIER.locale.en-US.yaml" -# echo "PackageVersion: $RELEASE_VERSION" >> "$root/$IDENTIFIER.locale.en-US.yaml" -# echo "PackageLocale: en-US" >> "$root/$IDENTIFIER.locale.en-US.yaml" -# echo "Publisher: $publisher" >> "$root/$IDENTIFIER.locale.en-US.yaml" -# echo "PackageName: $pkgname" >> "$root/$IDENTIFIER.locale.en-US.yaml" -# echo "PublisherUrl: https://github.com/$REPO" >> "$root/$IDENTIFIER.locale.en-US.yaml" -# echo "PublisherSupportUrl: https://github.com/$REPO/issues" >> "$root/$IDENTIFIER.locale.en-US.yaml" -# echo "Author: Dark-Alex-17" >> "$root/$IDENTIFIER.locale.en-US.yaml" -# echo "Moniker: gman" >> "$root/$IDENTIFIER.locale.en-US.yaml" -# echo "License: $license" >> "$root/$IDENTIFIER.locale.en-US.yaml" -# echo "LicenseUrl: https://github.com/$REPO/blob/main/LICENSE" >> "$root/$IDENTIFIER.locale.en-US.yaml" -# echo "ShortDescription: $desc" >> "$root/$IDENTIFIER.locale.en-US.yaml" -# echo "ManifestType: defaultLocale" >> "$root/$IDENTIFIER.locale.en-US.yaml" -# echo "ManifestVersion: 1.10.0" >> "$root/$IDENTIFIER.locale.en-US.yaml" -# -# echo "PackageIdentifier: $IDENTIFIER" >> "$root/$IDENTIFIER.installer.yaml" -# echo "PackageVersion: $RELEASE_VERSION" >> "$root/$IDENTIFIER.installer.yaml" -# echo "InstallerType: zip" >> "$root/$IDENTIFIER.installer.yaml" -# echo "Installers:" >> "$root/$IDENTIFIER.installer.yaml" -# echo " - Architecture: x64" >> "$root/$IDENTIFIER.installer.yaml" -# echo " InstallerUrl: $url_x64" >> "$root/$IDENTIFIER.installer.yaml" -# echo " InstallerSha256: $x64_sha" >> "$root/$IDENTIFIER.installer.yaml" -# echo " NestedInstallerType: portable" >> "$root/$IDENTIFIER.installer.yaml" -# echo " NestedInstallerFiles:" >> "$root/$IDENTIFIER.installer.yaml" -# echo " - RelativeFilePath: gman.exe" >> "$root/$IDENTIFIER.installer.yaml" -# echo " PortableCommandAlias: gman" >> "$root/$IDENTIFIER.installer.yaml" -# echo " - Architecture: arm64" >> "$root/$IDENTIFIER.installer.yaml" -# echo " InstallerUrl: $url_arm64" >> "$root/$IDENTIFIER.installer.yaml" -# echo " InstallerSha256: $arm64_sha" >> "$root/$IDENTIFIER.installer.yaml" -# echo " NestedInstallerType: portable" >> "$root/$IDENTIFIER.installer.yaml" -# echo " NestedInstallerFiles:" >> "$root/$IDENTIFIER.installer.yaml" -# echo " - RelativeFilePath: gman.exe" >> "$root/$IDENTIFIER.installer.yaml" -# echo " PortableCommandAlias: gman" >> "$root/$IDENTIFIER.installer.yaml" -# echo "ManifestType: installer" >> "$root/$IDENTIFIER.installer.yaml" -# echo "ManifestVersion: 1.10.0" >> "$root/$IDENTIFIER.installer.yaml" -# -# echo "Prepared manifests in $root" -# -# - name: Install .NET for WingetCreate -# if: steps.check.outputs.exists == 'false' && env.ACT != 'true' -# uses: actions/setup-dotnet@v4 -# with: -# dotnet-version: '8.0.x' -# -# - name: Install WingetCreate tool -# if: steps.check.outputs.exists == 'false' && env.ACT != 'true' -# run: | -# winget install wingetcreate -# -# - name: Submit initial package to winget-pkgs -# if: steps.check.outputs.exists == 'false' && env.ACT != 'true' -# shell: bash -# env: -# TOKEN: ${{ secrets.WINGET_GITHUB_TOKEN }} -# run: | -# set -euo pipefail -# wingetcreate submit winget-manifests/manifests --submit --token "$TOKEN" --owner microsoft - - name: Publish to winget (opens PR to microsoft/winget-pkgs) if: env.ACT != 'true' -# if: steps.check.outputs.exists == 'true' && env.ACT != 'true' uses: vedantmgoyal9/winget-releaser@v2 with: identifier: DarkAlex17.GMan @@ -509,103 +400,103 @@ jobs: installers-regex: '\.zip$' token: ${{ secrets.WINGET_GITHUB_TOKEN }} -# publish-homebrew-formula: -# needs: [publish-github-release] -# name: Update Homebrew formulas -# runs-on: ubuntu-latest -# steps: -# - name: Check if actor is repository owner -# if: ${{ github.actor != github.repository_owner && env.ACT != 'true' }} -# run: | -# echo "You are not authorized to run this workflow." -# exit 1 -# -# - name: Checkout repository -# uses: actions/checkout@v4 -# with: -# fetch-depth: 1 -# -# - name: Get release artifacts -# uses: actions/download-artifact@v4 -# with: -# path: artifacts -# merge-multiple: true -# -# - name: Set release assets and version -# shell: bash -# run: | -# # Set environment variables -# macos_sha="$(cat ./artifacts/gman-x86_64-apple-darwin.sha256 | awk '{print $1}')" -# echo "MACOS_SHA=$macos_sha" >> $GITHUB_ENV -# macos_sha_arm="$(cat ./artifacts/gman-aarch64-apple-darwin.sha256 | awk '{print $1}')" -# echo "MACOS_SHA_ARM=$macos_sha_arm" >> $GITHUB_ENV -# linux_sha="$(cat ./artifacts/gman-x86_64-unknown-linux-musl.sha256 | awk '{print $1}')" -# echo "LINUX_SHA=$linux_sha" >> $GITHUB_ENV -# release_version="$(cat ./artifacts/release-version)" -# echo "RELEASE_VERSION=$release_version" >> $GITHUB_ENV -# -# - name: Validate release environment variables -# run: | -# echo "Release SHA macos: ${{ env.MACOS_SHA }}" -# echo "Release SHA macos-arm: ${{ env.MACOS_SHA_ARM }}" -# echo "Release SHA linux musl: ${{ env.LINUX_SHA }}" -# echo "Release version: ${{ env.RELEASE_VERSION }}" -# -# - name: Execute Homebrew packaging script -# if: env.ACT != 'true' -# run: | -# # run packaging script -# python "./deployment/homebrew/packager.py" ${{ env.RELEASE_VERSION }} "./deployment/homebrew/gman.rb.template" "./gman.rb" ${{ env.MACOS_SHA }} ${{ env.MACOS_SHA_ARM }} ${{ env.LINUX_SHA }} -# -# - name: Push changes to Homebrew tap -# if: env.ACT != 'true' -# env: -# TOKEN: ${{ secrets.GMAN_GITHUB_TOKEN }} -# run: | -# # push to Git -# git config --global user.name "Dark-Alex-17" -# git config --global user.email "alex.j.tusa@gmail.com" -# git clone https://Dark-Alex-17:${{ secrets.GMAN_GITHUB_TOKEN }}@github.com/Dark-Alex-17/homebrew-gman.git -# rm homebrew-gman/Formula/gman.rb -# cp gman.rb homebrew-gman/Formula -# cd homebrew-gman -# git add . -# git diff-index --quiet HEAD || git commit -am "Update formula for G-Man release ${{ env.RELEASE_VERSION }}" -# git push https://$TOKEN@github.com/Dark-Alex-17/homebrew-gman.git -# -# publish-crate: -# needs: publish-github-release -# name: Publish Crate -# runs-on: ubuntu-latest -# steps: -# - name: Check if actor is repository owner -# if: ${{ github.actor != github.repository_owner && env.ACT != 'true' }} -# run: | -# echo "You are not authorized to run this workflow." -# exit 1 -# -# - name: Checkout -# uses: actions/checkout@v4 -# with: -# fetch-depth: 0 -# -# - name: Get bumped Cargo files (Act) -# if: env.ACT == 'true' -# uses: actions/download-artifact@v4 -# with: -# name: bumped-cargo-files -# path: ${{ github.workspace }} -# -# - name: Ensure repository is up-to-date -# if: env.ACT != 'true' -# run: | -# git fetch --all -# git pull -# -# - name: Install Rust stable -# uses: dtolnay/rust-toolchain@stable -# -# - uses: katyo/publish-crates@v2 -# if: env.ACT != 'true' -# with: -# registry-token: ${{ secrets.CARGO_REGISTRY_TOKEN }} + publish-homebrew-formula: + needs: [publish-github-release] + name: Update Homebrew formulas + runs-on: ubuntu-latest + steps: + - name: Check if actor is repository owner + if: ${{ github.actor != github.repository_owner && env.ACT != 'true' }} + run: | + echo "You are not authorized to run this workflow." + exit 1 + + - name: Checkout repository + uses: actions/checkout@v4 + with: + fetch-depth: 1 + + - name: Get release artifacts + uses: actions/download-artifact@v4 + with: + path: artifacts + merge-multiple: true + + - name: Set release assets and version + shell: bash + run: | + # Set environment variables + macos_sha="$(cat ./artifacts/gman-x86_64-apple-darwin.sha256 | awk '{print $1}')" + echo "MACOS_SHA=$macos_sha" >> $GITHUB_ENV + macos_sha_arm="$(cat ./artifacts/gman-aarch64-apple-darwin.sha256 | awk '{print $1}')" + echo "MACOS_SHA_ARM=$macos_sha_arm" >> $GITHUB_ENV + linux_sha="$(cat ./artifacts/gman-x86_64-unknown-linux-musl.sha256 | awk '{print $1}')" + echo "LINUX_SHA=$linux_sha" >> $GITHUB_ENV + release_version="$(cat ./artifacts/release-version)" + echo "RELEASE_VERSION=$release_version" >> $GITHUB_ENV + + - name: Validate release environment variables + run: | + echo "Release SHA macos: ${{ env.MACOS_SHA }}" + echo "Release SHA macos-arm: ${{ env.MACOS_SHA_ARM }}" + echo "Release SHA linux musl: ${{ env.LINUX_SHA }}" + echo "Release version: ${{ env.RELEASE_VERSION }}" + + - name: Execute Homebrew packaging script + if: env.ACT != 'true' + run: | + # run packaging script + python "./deployment/homebrew/packager.py" ${{ env.RELEASE_VERSION }} "./deployment/homebrew/gman.rb.template" "./gman.rb" ${{ env.MACOS_SHA }} ${{ env.MACOS_SHA_ARM }} ${{ env.LINUX_SHA }} + + - name: Push changes to Homebrew tap + if: env.ACT != 'true' + env: + TOKEN: ${{ secrets.GMAN_GITHUB_TOKEN }} + run: | + # push to Git + git config --global user.name "Dark-Alex-17" + git config --global user.email "alex.j.tusa@gmail.com" + git clone https://Dark-Alex-17:${{ secrets.GMAN_GITHUB_TOKEN }}@github.com/Dark-Alex-17/homebrew-gman.git + rm homebrew-gman/Formula/gman.rb + cp gman.rb homebrew-gman/Formula + cd homebrew-gman + git add . + git diff-index --quiet HEAD || git commit -am "Update formula for G-Man release ${{ env.RELEASE_VERSION }}" + git push https://$TOKEN@github.com/Dark-Alex-17/homebrew-gman.git + + publish-crate: + needs: publish-github-release + name: Publish Crate + runs-on: ubuntu-latest + steps: + - name: Check if actor is repository owner + if: ${{ github.actor != github.repository_owner && env.ACT != 'true' }} + run: | + echo "You are not authorized to run this workflow." + exit 1 + + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Get bumped Cargo files (Act) + if: env.ACT == 'true' + uses: actions/download-artifact@v4 + with: + name: bumped-cargo-files + path: ${{ github.workspace }} + + - name: Ensure repository is up-to-date + if: env.ACT != 'true' + run: | + git fetch --all + git pull + + - name: Install Rust stable + uses: dtolnay/rust-toolchain@stable + + - uses: katyo/publish-crates@v2 + if: env.ACT != 'true' + with: + registry-token: ${{ secrets.CARGO_REGISTRY_TOKEN }} diff --git a/Cargo.toml b/Cargo.toml index aefd9ab..7ebad54 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -3,8 +3,8 @@ name = "gman" version = "0.0.2" edition = "2024" authors = ["Alex Clarke "] -description = "Universal secret management and injection tool" -keywords = ["cli", "secrets", "credentials", "command-line", "encryption"] +description = "Universal command line secret management and injection tool" +keywords = ["cli", "secrets-manager", "secret-injection", "command-runner", "vault"] documentation = "https://github.com/Dark-Alex-17/gman" repository = "https://github.com/Dark-Alex-17/gman" homepage = "https://github.com/Dark-Alex-17/gman" diff --git a/README.md b/README.md index 83a69c4..469e191 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# G-Man - Universal CLI Credential Manager and Injection Tool +# G-Man - Universal Command Line Secret Manager and Injection Tool ![Check](https://github.com/Dark-Alex-17/gman/actions/workflows/check.yml/badge.svg) ![Test](https://github.com/Dark-Alex-17/gman/actions/workflows/test.yml/badge.svg)