Skip to content

Add: lock追加忘れ #57

Add: lock追加忘れ

Add: lock追加忘れ #57

name: Build
on:
push:
tags:
- "v*"
workflow_dispatch:
inputs:
version:
description: バージョン
required: true
description:
description: 説明
required: false
jobs:
build-vite:
name: Build with vite
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
version: 9
- name: Setup node
uses: actions/setup-node@v4
with:
node-version: 20
cache: pnpm
- name: Install dependencies
run: |
pnpm i
- name: Change version in package.json
run: |
if [ -n "${{ github.event.inputs.version }}" ]; then
VERSION="${{ github.event.inputs.version }}" # "
else
RAW_VERSION="${{ github.ref_name }}" # "
VERSION=${RAW_VERSION#v}
fi
pnpm update-version.js $VERSION
echo Version: $VERSION
- name: Build with vite
run: |
pnpm build:vite
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: vite-compiled
path: dist
build-electron:
strategy:
matrix:
name:
- windows
- mac-x64
- mac-arm64
- linux
include:
- os: windows-latest
path: dist-electron/*.exe
build-args: ""
name: windows
- os: macos-latest
path: dist-electron/*.dmg
build-args: "--x64"
name: mac-x64
ext: x64
- os: macos-latest
path: dist-electron/*.dmg
build-args: "--arm64"
name: mac-arm64
- os: ubuntu-latest
path: dist-electron/*.AppImage
build-args: ""
name: linux
runs-on: ${{ matrix.os }}
needs:
- build-vite
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
version: 9
- name: Setup node
uses: actions/setup-node@v4
with:
node-version: 20
cache: pnpm
- name: Install dependencies
run: |
pnpm i
- name: Download artifact
uses: actions/download-artifact@v4
with:
name: vite-compiled
path: dist
- name: Change version in package.json
shell: bash
run: |
if [ -n "${{ github.event.inputs.version }}" ]; then
VERSION="${{ github.event.inputs.version }}" # "
else
RAW_VERSION="${{ github.ref_name }}" # "
VERSION=${RAW_VERSION#v}
fi
pnpm update-version.js $VERSION
echo Version: $VERSION
- name: Build electron
run: |
pnpm build:electron ${{ matrix.build-args }}
- name: Change extension
if: matrix.ext != ''
shell: bash
run: |
FILE=$(ls ${{ matrix.path }})
mv "${FILE}" "${FILE%.*}-${{ matrix.ext }}.${FILE##*.}"
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.name }}-electron-built
path: ${{ matrix.path }}
if-no-files-found: error
release:
name: Upload release
runs-on: ubuntu-latest
needs:
- build-electron
steps:
- name: Checkout Repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Download windows binary
uses: actions/download-artifact@v4
with:
name: windows-electron-built
path: dist
- name: Download macos x64 binary
uses: actions/download-artifact@v4
with:
name: mac-x64-electron-built
path: dist
- name: Download macos arm64 binary
uses: actions/download-artifact@v4
with:
name: mac-arm64-electron-built
path: dist
- name: Download linux binary
uses: actions/download-artifact@v4
with:
name: linux-electron-built
path: dist
- name: Setup resources
id: version
run: |
if [ -n "${{ github.event.inputs.version }}" ]; then
VERSION="${{ github.event.inputs.version }}" # "
else
RAW_VERSION="${{ github.ref_name }}" # "
VERSION=${RAW_VERSION#v}
fi
echo "version=$VERSION" >> $GITHUB_OUTPUT
if [[ $VERSION == *"-"* ]]; then
PREVIEW=true
else
PREVIEW=false
fi
echo "preview=$PREVIEW" >> $GITHUB_OUTPUT
echo "Version: $VERSION, is preview: $PREVIEW"
cat > description.txt << EOS
Windows環境ではSetup.$VERSION.exe、
Mac環境では$VERSION-x64.dmg、([Appleシリコン搭載](https://support.apple.com/ja-jp/HT211814)の場合は$VERSION-arm64.dmg)、
Linux環境では$VERSION.AppImageをダウンロードして下さい。
### Mac(x64):「"Kiite Cafe Desktop"の開発元を検証できないため開けません。」が出た場合
Finder で、Control キーを押しながらダウンロードしたアプリをクリックし、メニューから「開く」をクリックしてください。
または、「システム環境設定」→「セキュリティとプライバシー」→「一般」→「このまま開く」をクリックして下さい。
### Mac(arm64):「"Kiite Cafe Desktop"は壊れているため開けません。ゴミ箱に入れる必要があります。」が出た場合
ターミナルを開き、以下のコマンドを実行して下さい:
\`\`\`zsh
sudo xattr -d com.apple.quarantine "/Applications/Kiite Cafe Desktop.app"
\`\`\`
> **Warning**
> 開発者がMacの実機を持っていないため、記述が間違っている場合があります。
----
<details>
<summary>コミットログ</summary>
EOS
if [ -n "${{ github.event.inputs.version }}" ]; then
LAST_VERSION=$(git tag -l --sort=-creatordate | sed "/.*-preview.*/d" | sed -n "1p")
else
LAST_VERSION=$(git tag -l --sort=-creatordate | sed "/.*-preview.*/d"| sed -n "2p")
fi
git log $LAST_VERSION...HEAD --pretty=format:"- %s" | head -n -1 >> description.txt
cat >> description.txt << EOS
</details>
EOS
if [ -n "${{ github.event.inputs.description }}" ]; then
cat >> description.txt << EOS
----
${{ github.event.inputs.description }}
EOS
fi
- name: Upload release
uses: softprops/action-gh-release@v2
with:
tag_name: v${{ steps.version.outputs.version }}
prerelease: ${{ steps.version.outputs.preview }}
body_path: description.txt
files: |
dist/*