Skip to content

Release

Release #2

Workflow file for this run

name: Release
on:
push:
tags:
- 'v*'
env:
CARGO_TERM_COLOR: always
jobs:
create-release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Debug Info
run: |
echo "GitHub Ref: ${{ github.ref }}"
echo "GitHub Event Name: ${{ github.event_name }}"
echo "GitHub Repository: ${{ github.repository }}"
- 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
outputs:
upload_url: ${{ steps.create_release.outputs.upload_url }}
build-release:
needs: create-release
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
asset_name: gpt-linux-amd64
- os: windows-latest
target: x86_64-pc-windows-msvc
asset_name: gpt-windows-amd64.exe
- os: macos-latest
target: x86_64-apple-darwin
asset_name: gpt-macos-amd64
steps:
- uses: actions/checkout@v4
- name: Debug Info
run: |
echo "OS: ${{ matrix.os }}"
echo "Target: ${{ matrix.target }}"
echo "Asset Name: ${{ matrix.asset_name }}"
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
target: ${{ matrix.target }}
override: true
- name: Build
uses: actions-rs/cargo@v1
with:
command: build
args: --release --target ${{ matrix.target }}
- name: List Build Directory
run: |
ls -R target/
- name: Rename binary
shell: bash
run: |
if [ "${{ matrix.os }}" = "windows-latest" ]; then
cp target/${{ matrix.target }}/release/gpt.exe ${{ matrix.asset_name }}
else
cp target/${{ matrix.target }}/release/gpt ${{ matrix.asset_name }}
fi
- name: Upload Release Asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.create-release.outputs.upload_url }}
asset_path: ./${{ matrix.asset_name }}
asset_name: ${{ matrix.asset_name }}
asset_content_type: application/octet-stream