Skip to content

[workflows/release] Try fixing release step permission #8

[workflows/release] Try fixing release step permission

[workflows/release] Try fixing release step permission #8

Workflow file for this run

name: Build and Release
on:
push:
tags:
- 'v*.*.*'
jobs:
build:
strategy:
matrix:
include:
- os: windows-latest
artifact_name: windows
- os: ubuntu-latest
artifact_name: linux
- os: macos-latest
artifact_name: macos
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.x'
- name: Install dependencies
run: pip install -r requirements.txt
- name: Build binary
run: pyinstaller --onefile gpt_cmd.py
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.artifact_name }}
path: 'dist/gpt_cmd*'
retention-days: 1
release:
runs-on: ubuntu-latest
needs: build
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- name: Download artifacts
uses: actions/download-artifact@v4
- name: Rename artifacts
run: |
mkdir -p bin
for os in windows linux macos; do
ext=""
if [ "$os" = "windows" ]; then
ext=".exe"
fi
src="${os}/gpt_cmd${ext}"
dest="bin/gpt_cmd-${os}${ext}"
echo "Moving $src to $dest"
mv "$src" "$dest"
rm -rf "${os}/"
done
- name: Create release
uses: ncipollo/release-action@v1.14.0
with:
artifacts: 'bin/gpt_cmd*'
tag: ${{ github.ref }}
name: ${{ github.ref }}