feat: update GitHub Actions workflow for improved artifact handling and release process
This commit is contained in:
88
.github/workflows/release.yml
vendored
88
.github/workflows/release.yml
vendored
@@ -14,65 +14,57 @@ jobs:
|
|||||||
include:
|
include:
|
||||||
- os: ubuntu-latest
|
- os: ubuntu-latest
|
||||||
target: x86_64-unknown-linux-gnu
|
target: x86_64-unknown-linux-gnu
|
||||||
|
asset_name: codebase-to-prompt-linux-amd64
|
||||||
- os: macos-latest
|
- os: macos-latest
|
||||||
target: x86_64-apple-darwin
|
target: x86_64-apple-darwin
|
||||||
|
asset_name: codebase-to-prompt-macos-amd64
|
||||||
- os: windows-latest
|
- os: windows-latest
|
||||||
target: x86_64-pc-windows-msvc
|
target: x86_64-pc-windows-msvc
|
||||||
|
asset_name: codebase-to-prompt-windows-amd64.exe
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- name: Checkout code
|
||||||
- name: Build
|
uses: actions/checkout@v4
|
||||||
run: cargo build --release --target ${{ matrix.target }}
|
|
||||||
- name: Upload Artifact
|
- name: Install Rust toolchain
|
||||||
uses: actions/upload-artifact@v2
|
uses: dtolnay/rust-toolchain@stable
|
||||||
with:
|
with:
|
||||||
name: codebase-to-prompt-${{ matrix.target }}
|
targets: ${{ matrix.target }}
|
||||||
path: target/${{ matrix.target }}/release/codebase-to-prompt*
|
|
||||||
|
- name: Build binary
|
||||||
|
run: cargo build --release --target ${{ matrix.target }}
|
||||||
|
|
||||||
|
- name: Prepare artifact path
|
||||||
|
id: artifact_path
|
||||||
|
run: |
|
||||||
|
if [ "${{ matrix.os }}" = "windows-latest" ]; then
|
||||||
|
echo "path=target/${{ matrix.target }}/release/codebase-to-prompt.exe" >> $GITHUB_OUTPUT
|
||||||
|
else
|
||||||
|
echo "path=target/${{ matrix.target }}/release/codebase-to-prompt" >> $GITHUB_OUTPUT
|
||||||
|
fi
|
||||||
|
|
||||||
|
- name: Upload artifact
|
||||||
|
uses: actions/upload-artifact@v4
|
||||||
|
with:
|
||||||
|
name: ${{ matrix.asset_name }}
|
||||||
|
path: ${{ steps.artifact_path.outputs.path }}
|
||||||
|
|
||||||
release:
|
release:
|
||||||
name: Create Release
|
name: Create GitHub Release
|
||||||
needs: build
|
needs: build
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
permissions:
|
||||||
|
contents: write # This is required to create a release and upload assets
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- name: Download all artifacts
|
||||||
- name: Download Artifacts
|
uses: actions/download-artifact@v4
|
||||||
uses: actions/download-artifact@v2
|
|
||||||
with:
|
with:
|
||||||
path: artifacts
|
path: artifacts/
|
||||||
- name: Create Release
|
|
||||||
id: create_release
|
- name: Create Release and Upload Assets
|
||||||
uses: actions/create-release@v1
|
uses: softprops/action-gh-release@v2
|
||||||
env:
|
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
with:
|
with:
|
||||||
tag_name: ${{ github.ref }}
|
files: |
|
||||||
release_name: Release ${{ github.ref }}
|
artifacts/codebase-to-prompt-linux-amd64/*
|
||||||
draft: false
|
artifacts/codebase-to-prompt-macos-amd64/*
|
||||||
prerelease: false
|
artifacts/codebase-to-prompt-windows-amd64.exe/*
|
||||||
- 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
|
|
||||||
|
Reference in New Issue
Block a user