Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 61 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: Build and Release

on:
push:
branches:
- "release/v[0-9]-[0-9]*"

jobs:
build-and-release:
runs-on: windows-latest
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup MSBuild
uses: microsoft/setup-msbuild@v2

# ブランチ名からバージョン番号を抽出
- name: Extract Version from Branch
id: get_version
shell: bash
run: |
BRANCH_NAME=${GITHUB_REF#refs/heads/release/v}
VERSION_BASE=${BRANCH_NAME//-/. }
echo "VERSION_BASE=$VERSION_BASE" >> $GITHUB_OUTPUT

# バージョン変数を定義
- name: Set Version
id: version
shell: bash
run: |
VERSION=v${{ steps.get_version.outputs.VERSION_BASE }}.${{ github.run_number }}
echo "VERSION=$VERSION" >> $GITHUB_OUTPUT

# ビルド
- name: Build
run: |
echo "Building version ${{ steps.version.outputs.VERSION }}"
msbuild desktop.sln `
/p:Configuration=Release `
/p:Platform="Any CPU" `
/p:OutputPath=build_output/
/p:Version=${{ steps.version.outputs.VERSION }}

# 成果物をZIPにまとめる
- name: Archive Release
shell: pwsh
run: |
Compress-Archive -Path build_output/* -DestinationPath STOPGAME_${{ steps.version.outputs.VERSION }}.zip

# リリース作成
- name: Create Release
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ steps.version.outputs.VERSION }}
name: Release ${{ steps.version.outputs.VERSION }}
generate_release_notes: true
files: |
STOPGAME_${{ steps.version.outputs.VERSION }}.zip
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}