feat: add GitHub Actions workflow for automated release and installation script
This commit is contained in:
78
.github/workflows/release.yml
vendored
Normal file
78
.github/workflows/release.yml
vendored
Normal file
@@ -0,0 +1,78 @@
|
||||
name: Release
|
||||
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- "v*"
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: Build for ${{ matrix.os }}
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
matrix:
|
||||
include:
|
||||
- os: ubuntu-latest
|
||||
target: x86_64-unknown-linux-gnu
|
||||
- os: macos-latest
|
||||
target: x86_64-apple-darwin
|
||||
- os: windows-latest
|
||||
target: x86_64-pc-windows-msvc
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Build
|
||||
run: cargo build --release --target ${{ matrix.target }}
|
||||
- name: Upload Artifact
|
||||
uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: codebase-to-prompt-${{ matrix.target }}
|
||||
path: target/${{ matrix.target }}/release/codebase-to-prompt*
|
||||
|
||||
release:
|
||||
name: Create Release
|
||||
needs: build
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Download Artifacts
|
||||
uses: actions/download-artifact@v2
|
||||
with:
|
||||
path: artifacts
|
||||
- name: Create Release
|
||||
id: create_release
|
||||
uses: actions/create-release@v1
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
tag_name: ${{ github.ref }}
|
||||
release_name: Release ${{ github.ref }}
|
||||
draft: false
|
||||
prerelease: false
|
||||
- name: Upload Release Asset (Linux)
|
||||
uses: actions/upload-release-asset@v1
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
||||
asset_path: ./artifacts/codebase-to-prompt-x86_64-unknown-linux-gnu/codebase-to-prompt
|
||||
asset_name: codebase-to-prompt-x86_64-unknown-linux-gnu
|
||||
asset_content_type: application/octet-stream
|
||||
- name: Upload Release Asset (macOS)
|
||||
uses: actions/upload-release-asset@v1
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
||||
asset_path: ./artifacts/codebase-to-prompt-x86_64-apple-darwin/codebase-to-prompt
|
||||
asset_name: codebase-to-prompt-x86_64-apple-darwin
|
||||
asset_content_type: application/octet-stream
|
||||
- name: Upload Release Asset (Windows)
|
||||
uses: actions/upload-release-asset@v1
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
||||
asset_path: ./artifacts/codebase-to-prompt-x86_64-pc-windows-msvc/codebase-to-prompt.exe
|
||||
asset_name: codebase-to-prompt-x86_64-pc-windows-msvc.exe
|
||||
asset_content_type: application/octet-stream
|
28
install.sh
Normal file
28
install.sh
Normal file
@@ -0,0 +1,28 @@
|
||||
#!/bin/sh
|
||||
# install.sh
|
||||
#
|
||||
# This script downloads and installs the latest release of codebase-to-prompt.
|
||||
set -e
|
||||
|
||||
LATEST_RELEASE=$(curl -s "https://api.github.com/repos/GKaszewski/codebase-to-prompt/releases/latest" | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/')
|
||||
|
||||
OS=$(uname -s | tr '[:upper:]' '[:lower:]')
|
||||
ARCH=$(uname -m)
|
||||
|
||||
TARGET=""
|
||||
if [ "$OS" = "linux" ] && [ "$ARCH" = "x86_64" ]; then
|
||||
TARGET="x86_64-unknown-linux-gnu"
|
||||
elif [ "$OS" = "darwin" ] && [ "$ARCH" = "x86_64" ]; then
|
||||
TARGET="x86_64-apple-darwin"
|
||||
else
|
||||
echo "Unsupported OS or architecture: $OS $ARCH"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
DOWNLOAD_URL="https://github.com/GKaszewski/codebase-to-prompt/releases/download/$LATEST_RELEASE/codebase-to-prompt-$TARGET"
|
||||
curl -L "$DOWNLOAD_URL" -o codebase-to-prompt
|
||||
|
||||
chmod +x codebase-to-prompt
|
||||
mv codebase-to-prompt /usr/local/bin/
|
||||
|
||||
echo "codebase-to-prompt installed successfully!"
|
Reference in New Issue
Block a user