Skip to content

fixing bug with the name for windows auto completion #120

fixing bug with the name for windows auto completion

fixing bug with the name for windows auto completion #120

Workflow file for this run

name: Release CLI (test)
on:
workflow_dispatch:
inputs:
publish_release:
description: "Publish / update the test prerelease (v0.0.0-test)"
type: boolean
required: false
default: true
push:
branches:
- feature/cli-0.2.0
concurrency:
group: release-test
cancel-in-progress: true
jobs:
build-linux:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: oven-sh/setup-bun@v1
with:
bun-version: latest
- run: bun install
- name: Build Linux
run: |
set -euo pipefail
mkdir -p dist/bin dist/archives
bun build src/cli.ts --compile --target=bun-linux-x64 --outfile=dist/bin/ek
# ✅ COPY COMPLETION FILES
cp src/complete/ek.bash dist/bin/
cp src/complete/ek.zsh dist/bin/
tar -czf dist/archives/enkryptify_Linux_x86_64.tar.gz -C dist/bin ek ek.bash ek.zsh
bun build src/cli.ts --compile --target=bun-linux-arm64 --outfile=dist/bin/ek
# ✅ COPY COMPLETION FILES (again for arm64)
cp src/complete/ek.bash dist/bin/
cp src/complete/ek.zsh dist/bin/
tar -czf dist/archives/enkryptify_Linux_arm64.tar.gz -C dist/bin ek ek.bash ek.zsh
sha256sum dist/archives/*.tar.gz > dist/archives/checksums.txt
- uses: actions/upload-artifact@v4
with:
name: linux
path: dist/archives/*
build-macos:
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: oven-sh/setup-bun@v1
with:
bun-version: latest
- run: bun install
- name: Build macOS
run: |
set -euo pipefail
mkdir -p dist/bin dist/archives
# Build binaries
bun build src/cli.ts --compile --target=bun-darwin-x64 --outfile=dist/bin/ek
bun build src/cli.ts --compile --target=bun-darwin-arm64 --outfile=dist/bin/ek
# ✅ COPY COMPLETION FILES
cp src/complete/ek.bash dist/bin/
cp src/complete/ek.zsh dist/bin/
# Package
tar -czf dist/archives/enkryptify_Darwin_x86_64.tar.gz -C dist/bin ek ek.bash ek.zsh
tar -czf dist/archives/enkryptify_Darwin_arm64.tar.gz -C dist/bin ek ek.bash ek.zsh
shasum -a 256 dist/archives/*.tar.gz > dist/archives/checksums.txt
- uses: actions/upload-artifact@v4
with:
name: macos
path: dist/archives/*
build-windows:
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- uses: oven-sh/setup-bun@v1
with:
bun-version: latest
- run: bun install
- name: Build Windows
shell: pwsh
run: |
New-Item -ItemType Directory -Force dist\bin\enkryptify-completion | Out-Null
New-Item -ItemType Directory -Force dist\archives | Out-Null
# Build CLI
bun build src/cli.ts --compile --target=bun-windows-x64 --outfile=dist\bin\ek.exe
# Copy PowerShell module INTO A FOLDER
Copy-Item src\complete\enkryptify-completion.psm1 dist\bin\enkryptify-completion\
# Zip layout MUST contain:
# ek.exe
# enkryptify-completion/enkryptify-completion.psm1
Compress-Archive `
-Path dist\bin\ek.exe, dist\bin\enkryptify-completion `
-DestinationPath dist\archives\enkryptify_Windows_x86_64.zip
publish:
needs: [build-linux, build-macos, build-windows]
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Get version from package.json
id: version
run: |
VERSION=$(node -p "require('./package.json').version")
TAG="v${VERSION}-test"
echo "version=$VERSION" >> $GITHUB_OUTPUT
echo "tag=$TAG" >> $GITHUB_OUTPUT
- uses: actions/download-artifact@v4
with:
path: dist/archives
merge-multiple: true
- name: Create combined checksums
run: |
cd dist/archives
rm -f checksums.txt
sha256sum *.tar.gz > checksums.txt || shasum -a 256 *.tar.gz > checksums.txt
- name: Move test tag
if: ${{ github.event_name == 'push' || inputs.publish_release }}
run: |
git config user.name "Enkryptify Bot"
git config user.email "bot@enkryptify.com"
git tag -f ${{ steps.version.outputs.tag }}
git push -f origin ${{ steps.version.outputs.tag }}
- name: Publish GitHub prerelease
if: ${{ github.event_name == 'push' || inputs.publish_release }}
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ steps.version.outputs.tag }}
prerelease: true
overwrite_files: true
files: dist/archives/*
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Update Homebrew test tap
if: ${{ github.event_name == 'push' || inputs.publish_release }}
env:
TAP_TOKEN: ${{ secrets.GH_TOKEN }}
run: |
set -euo pipefail
git clone https://x-access-token:${TAP_TOKEN}@github.com/Enkryptify/homebrew-enkryptify-test.git
cd homebrew-enkryptify-test
git config user.name "Enkryptify Bot"
git config user.email "bot@enkryptify.com"
ARM_SHA=$(grep enkryptify_Darwin_arm64.tar.gz ../dist/archives/checksums.txt | awk '{print $1}')
X64_SHA=$(grep enkryptify_Darwin_x86_64.tar.gz ../dist/archives/checksums.txt | awk '{print $1}')
VERSION="${{ steps.version.outputs.version }}"
TAG="${{ steps.version.outputs.tag }}"
cat > Formula/enkryptify.rb <<EOF
class Enkryptify < Formula
desc "Enkryptify CLI (test)"
homepage "https://enkryptify.com"
version "${VERSION}-test"
on_macos do
if Hardware::CPU.arm?
url "https://github.com/Enkryptify/cli/releases/download/${TAG}/enkryptify_Darwin_arm64.tar.gz"
sha256 "${ARM_SHA}"
else
url "https://github.com/Enkryptify/cli/releases/download/${TAG}/enkryptify_Darwin_x86_64.tar.gz"
sha256 "${X64_SHA}"
end
end
def install
bin.install "ek"
bash_completion.install "ek.bash" => "ek"
zsh_completion.install "ek.zsh" => "_ek"
end
test do
system "#{bin}/ek", "--help"
end
end
EOF
git add Formula/enkryptify.rb
git commit -m "Update test formula ${{ steps.version.outputs.tag }}"
git push
- name: Update Scoop test bucket
if: ${{ github.event_name == 'push' || inputs.publish_release }}
env:
SCOOP_TOKEN: ${{ secrets.GH_TOKEN }}
run: |
set -euo pipefail
git clone https://x-access-token:${SCOOP_TOKEN}@github.com/Enkryptify/scoop-enkryptify-test.git
cd scoop-enkryptify-test
git config user.name "Enkryptify Bot"
git config user.email "bot@enkryptify.com"
VERSION="${{ steps.version.outputs.version }}-test"
TAG="${{ steps.version.outputs.tag }}"
ZIP="enkryptify_Windows_x86_64.zip"
URL="https://github.com/Enkryptify/cli/releases/download/${TAG}/${ZIP}"
# Compute SHA
SHA=$(curl -fsSL "$URL" | sha256sum | awk '{print $1}')
cat > enkryptify.json <<EOF
{
"version": "${VERSION}",
"architecture": {
"64bit": {
"url": "${URL}",
"hash": "${SHA}"
}
},
"bin": "ek.exe",
"psmodule": {
"name": "enkryptify-completion",
"root": "enkryptify-completion"
}
}
EOF
git add enkryptify.json
git commit -m "Update enkryptify ${VERSION}"
git push