Skip to content

fix(workflows/release.yml): Fix release workflos #5

fix(workflows/release.yml): Fix release workflos

fix(workflows/release.yml): Fix release workflos #5

Workflow file for this run

name: Release

Check failure on line 1 in .github/workflows/release.yml

View workflow run for this annotation

GitHub Actions / .github/workflows/release.yml

Invalid workflow file

(Line: 34, Col: 14): Unexpected symbol: 'ref_name#v'. Located at position 8 within expression: github.ref_name#v
on:
release:
types: [created]
jobs:
build-macos:
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
- name: Extract BUILD_VERSION and set GITHUB_ENV
run: |
TAG_NAME="${{ github.ref_name }}"
VERSION="${TAG_NAME#v}"
echo "BUILD_VERSION=$VERSION" >> $GITHUB_ENV
echo "Set BUILD_VERSION to $VERSION"
shell: bash
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.13'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install flet==0.28.3
# Generate requirements.txt for flet build
echo "flet==0.28.3" > requirements.txt
- name: Update src/__version.py__ in one line using bash
run: |
# ${parameter#word} というbashの機能を使って 'v' を除去
VERSION_NUM="${{ github.ref_name#v }}"
# 1行でファイルに書き込む
echo "VERSION = \"$VERSION_NUM\"" > src/__version.py__
shell: bash
- name: Flet Build macOS
run: |
flet build macos --build-version ${{ env.BUILD_VERSION }} --build-number ${{ github.run_number }}
- name: Zip macOS App
run: |
cd build/macos
zip -r human_chat_completions_macos.zip human_chat_completions.app
- name: Upload Release Asset
uses: softprops/action-gh-release@v1
with:
files: build/macos/human_chat_completions_macos.zip
build-windows:
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- name: Extract BUILD_VERSION and set GITHUB_ENV
run: |
TAG_NAME="${{ github.ref_name }}"
VERSION="${TAG_NAME#v}"
echo "BUILD_VERSION=$VERSION" >> $GITHUB_ENV
echo "Set BUILD_VERSION to $VERSION"
# Windowsでもbashが使えるため、このシェルスクリプトは全OSで動作する
shell: bash
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.13'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install flet==0.28.3
# Generate requirements.txt for flet build
echo "flet==0.28.3" > requirements.txt
- name: Update src/__version.py__ in one line using PowerShell
run: |
# PowerShellの構文でバージョン番号を取得
$versionNum = "${{ github.ref_name }}".Substring(1)
# Add-Content コマンドでファイルに書き込む
# "-Encoding UTF8" を指定して文字化けを防ぐ
"VERSION = `"$versionNum`"" | Add-Content -Path src/__version.py__ -Encoding UTF8
shell: powershell
- name: Install Inno Setup
run: |
choco install innosetup
- name: Flet Build Windows
run: |
flet build windows --build-version ${{ env.BUILD_VERSION }} --build-number ${{ github.run_number }}
env:
PYTHONUTF8: 1
- name: Build Installer
run: |
iscc inno-setup/setup.iss
- name: Upload Release Asset
uses: softprops/action-gh-release@v1
with:
files: inno-setup/Output/human_chat_completions_v${{ env.BUILD_VERSION }}_windows_setup.exe
build-linux:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Extract BUILD_VERSION and set GITHUB_ENV
run: |
TAG_NAME="${{ github.ref_name }}"
VERSION="${TAG_NAME#v}"
echo "BUILD_VERSION=$VERSION" >> $GITHUB_ENV
echo "Set BUILD_VERSION to $VERSION"
shell: bash
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.13'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install flet==0.28.3
# Generate requirements.txt for flet build
echo "flet==0.28.3" > requirements.txt
- name: Update src/__version.py__ in one line using bash
run: |
# VERSION環境変数からバージョン番号を取得して、1行でファイルに書き込む
echo "VERSION = \"$VERSION\"" > src/__version.py__
shell: bash
- name: Install Linux Build Dependencies
run: |
sudo apt-get update
sudo apt-get install -y clang cmake ninja-build pkg-config libgtk-3-dev liblzma-dev libmpv-dev
- name: Flet Build Linux
run: |
flet build linux --build-number ${{ github.run_number }}
- name: Zip Linux Bundle
run: |
cd build/linux
zip -r human_chat_completions_linux.zip .
- name: Upload Release Asset
uses: softprops/action-gh-release@v1
with:
files: build/linux/human_chat_completions_linux.zip